godeng

package module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

README

godeng

Godeng is used to generate test logs. For example, to generate a large amount of test data in ELK. you can define the rule and name of the fields, and godeng will automatically generate the data for you.

Godeng depends on gofakeit, thanks to gofakeit 🥰

👨‍💻 installation

You can install godeng using the following

1. 📦 Using .tar.gz archive

Download gzip file from Github Releases according to your OS. Then, copy the unzipped executable to under system path.

2. 🐳 Docker
docker run --rm chenjiayao/godeng

🧑‍💻 Usage

There are useful options.

Flags:
      --config string      config file (default "./dodeng.json")
      --count int          count (default 100)
      --file string        output file, only used when output is file (default "./godeng.out")
      --format string      output format (default "json")
  -h, --help               help for godeng
      --loop               loop output forever until killed. if loop is set, then count is ignored
      --output string      output (default "stdout")
      --sleep int          fix creation time interval for each log (second)
      --tablename string   tablename, only used when output is sql (default "godeng")
      --url string         http request url,only used when output is http/https and format is json

Examples

Send a post request to http://some.website every 3 seconds, and never exit
>>> godeng --config=godeng.json --url=http://some.website --sleep=3 --loop

Generate 100 sql statements to insert into the faker table
>>> godeng --config=godeng.json --format=sql --coun=100 --tablemame=faker 

Output 100 json data to output.json file
>>> godeng --config=godeng.json --format=json --output=file --file=output.json

🛠 config

The config file defines the properties of each field, each field has at least two properties: key and type. godeng will generate the data according to the definition of the config file. the specific writing rules can be seen in the example/example.json file

Support Formats

  • json
  • sql

Support output

  • stdout
  • file
  • http

Support type

  • string
  • int
  • float
  • ipv4
  • mac
  • ipv6
  • bool
  • enum
  • url
  • datetime
  • timestamp
  • email
  • sequence
  • ua (user-agent)
  • uuid
  • sentence

Issue

if you need more ouput/format/support type or find a bug, please raise a issue.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func Parser

func Parser(cfgFile string) (*Config, error)

type ConfigItem

type ConfigItem struct {
	// contains filtered or unexported fields
}

type GoDeng

type GoDeng struct {
	// contains filtered or unexported fields
}

func MakeGoDeng

func MakeGoDeng(cfg *Config, o string, f string, count int64, loop bool, sleep int64, url string, tablename string, file string) (*GoDeng, error)

func (*GoDeng) Start

func (g *GoDeng) Start()

Directories

Path Synopsis
cmd
sub

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL