137

GitHub - mingrammer/flog: A fake log generator for common log formats

 6 years ago
source link: https://github.com/mingrammer/flog
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md



Flog

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667 68747470733a2f2f676f7265706f7274636172642e636f6d2f62616467652f6769746875622e636f6d2f6d696e6772616d6d65722f666c6f67 68747470733a2f2f7472617669732d63692e6f72672f6d696e6772616d6d65722f666c6f672e7376673f6272616e63683d6d6173746572

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.

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 https://github.com/mingrammer/flog.git
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.

Usage

There are useful options. (flog --help)

Options:
  -f, --format string      Choose log format. ("apache_common"|"apache_combined"|"apache_error"|"rfc3164") (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 generate.
  -b, --bytes integer      Size of logs to generate. (in bytes)
                           "bytes" will be ignored when "number" is set.
  -s, --sleep numeric      Sleep interval time between lines. (in seconds)
  -p, --split-by integer   Split the logs by this value in lines or bytes.
                           When "number" is set, it specifies the maximum number of lines for a log file.
                           When "bytes" is set, it specifies the maximum size of a log file.
  -w, --overwrite          [Warning] This will overwrite the existing file with new created logs.
# 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

Features

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

License

MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK