GithubHelp home page GithubHelp logo

lecaros / flog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chronosphereio/calyptia-flog

0.0 0.0 0.0 1.09 MB

:tophat: A fake log generator for common log formats

License: MIT License

Go 99.14% Dockerfile 0.86%

flog's Introduction

Flog

go report card travis ci docker download

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 -u 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      log format. available formats:
                           - apache_common
                           - apache_combined
                           - apache_error (default)
                           - rfc3164
                           - rfc5424
                           - json
                           - spring_boot
  -o, --output string      output filename. Path-like is allowed. (default "generated.log")
  -t, --type string        log output type. available types:
                           - stdout (default)
                           - log
                           - gz
  -n, --number integer     number of lines to generate.
  -b, --bytes integer      size of log line to generate in bytes (default 512).
                           "bytes" will be ignored when "number" is set.
  -s, --sleep duration     fix creation time interval for each log (default unit "seconds"). It does not actually sleep.
                           examples: 10, 20ms, 5s, 1m
  -r, --rate rate          # of logs per second
  -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 200 lines of logs with a time interval of 10s for each log. It doesn't actually sleep while generating
$ flog -s 10s -n 200 

# 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 300ms. It actually sleep (delay) while generating
$ flog -t gz -o log.gz -n 3000 -d 10s

# Generate logs up to 10MB and split log files every 1MB in "web/log/*.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 until killed
$ flog -f rfc3164 -l

Supported Formats

  • Apache common
  • Apache combined
  • Apache error
  • RFC3164
  • RFC5424
  • Common log fomat
  • JSON
  • Spring boot default

Supported Outputs

  • Stdout
  • File
  • Gzip

License

MIT

flog's People

Contributors

boyter avatar cometkim avatar emepetres avatar glickel avatar lecaros avatar mingrammer avatar patrick-stephens avatar tcprbs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.