Skip to content
🎩 A fake log generator for common log formats
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dockerignore Update .dockerignore Apr 27, 2019
.gitignore Ignore .vscode/ Oct 8, 2018
.goreleaser.yml Use root folder for homebrew tap formula Dec 12, 2018
.travis.yml Update the supported versions Mar 27, 2019
Dockerfile Reduce the go modules rebuilds Apr 27, 2019
Gopkg.lock Update gofakeit Aug 20, 2018
Gopkg.toml
LICENSE
README.md Common log format (#22) May 29, 2019
array.go Rename ContainsString to containString Dec 3, 2018
array_test.go Rename ContainsString to containString Dec 3, 2018
flog.go Common log format (#22) May 29, 2019
flog_test.go Support random http version Jun 1, 2019
flog_unix.go Extract only OS specific functions Apr 22, 2018
flog_windows.go Support STDOUT and GZ log type Apr 22, 2018
go.mod Change the 'github.com/bouk/monky' to 'bou.ke/monkey' Dec 8, 2018
go.sum Change the 'github.com/bouk/monky' to 'bou.ke/monkey' Dec 8, 2018
log.go Support random http version Jun 1, 2019
log_test.go Support random http version Jun 1, 2019
main.go Reorder imports Aug 25, 2018
option.go Common log format (#22) May 29, 2019
option_test.go Add 'delay' option Dec 16, 2018
random.go Support random http version Jun 1, 2019
random_test.go Gofmt -s Apr 20, 2018
time.go Common log format (#22) May 29, 2019

README.md



Flog

A fake log generator for common log formats




flog is a fake log generator for common log formats such as apache-common, apache error and RFC3164 syslog.

It is useful for testing some tasks which require log data like amazon kinesis log stream test.

Thanks to gofakeit 😘

Installation

Using go get

go get github.com/mingrammer/flog

It is recommended to also run dep ensure to make sure that the dependencies are in the correct versions.

Using homebrew

brew tap mingrammer/flog
brew install flog

Using .tar.gz archive

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

Using docker

docker run -it --rm mingrammer/flog

Usage

There are useful options. (flog --help)

Options:
  -f, --format string      choose log format. ("apache_common"|"apache_combined"|"apache_error"|"rfc3164"|"rfc5424"|"common_log") (default "apache_common")
  -o, --output string      output filename. Path-like is allowed. (default "generated.log")
  -t, --type string        log output type. ("stdout"|"log"|"gz") (default "stdout")
  -n, --number integer     number of lines to generate.
  -b, --bytes integer      size of logs to generate (in bytes).
                           "bytes" will be ignored when "number" is set.
  -s, --sleep numeric      creation time interval for each log (in seconds). It does not actually sleep.
  -d, --delay numeric      delay log generation speed (in seconds).
  -p, --split-by integer   set the maximum number of lines or maximum size in bytes of a log file.
                           with "number" option, the logs will be split whenever the maximum number of lines is reached.
                           with "byte" option, the logs will be split whenever the maximum size in bytes is reached.
  -w, --overwrite          overwrite the existing log files.
  -l, --loop               loop output forever until killed.
# Generate 1000 lines of logs to stdout
flog

# Generate a single log file with 1000 lines of logs, then overwrite existing log file
flog -t log -w

# Generate a single log gzip file with 3000 lines of logs every 10 seconds
flog -t gz -o log.gz -n 3000 -s 10

# Generate logs up to 10MB and split the log files every 1MB in "web/log/apache.log" path with apache combined format
flog -t log -f apache_combined -o web/log/apache.log -b 10485760 -p 1048576

# Generate logs in rfc3164 format infinitely
flog -f rfc3164 -l

Features

  • Completely random log generator
  • Contextual random log generator
  • Statistical random log generator
  • Support apache common, apache combined, apache error, rfc3164, rfc5424 and common log format log formats
  • Support some other syslog formats
  • Support stdout, file and gzip type of logging

License

MIT

You can’t perform that action at this time.