Giter Club home page Giter Club logo

go-make-log's Introduction

go-make-log

Generate fake application log files (e.g. as input to log processors). This can be used to stress test the REST /var/log reader go-read-var-log.

For safety, this will not overwrite an existing file.

Warning: this does not check if disk space will be exhausted.

Sample Output

Create a JSON file (Running in Docker)

$ docker build -t go-make-log . && docker run -v $(pwd):/output go-make-log -f json -o /output/log.json
$ du -h log.json    # Disk space used
1.0M log.json
$ wc -l log.json    # Number of lines
7531 log.json
$ head -n 3 log.json
{"level":"debug","message":"etisat rif onafon ari y nih ogiwab fosa itecawo to sef weduh baro e halui","timestamp":"2023-10-04T22:03:14.754762Z"}
{"level":"debug","message":"alen ehof h edix ofisew i luwesa ca a hagur get tufiroy wuhoai iseba","timestamp":"2023-10-04T22:03:14.754954Z"}
{"level":"info","message":"p uriye esitos dociha tud oce nosen i sobihas lasobu talena h eto ic","timestamp":"2023-10-04T22:03:14.754994Z"}

Create a 1GiB file (Running Locally)

$ go run ./main -o log.txt -s 1GiB
$ du -h log.txt     # Disk space used
1.0G log.txt
$ wc -l log.txt     # Number of lines
10578414 log.txt
$ head -n 3 log.txt
2023-10-04T21:46:42.162239Z|info |ehuw ohemo elati l o wogeh arito akeho oheroc potawoh nes ha
2023-10-04T21:46:42.162360Z|debug|godet p zeni rela um beg epaheb bedi ihuyi yor tam el e afuni
2023-10-04T21:46:42.162376Z|debug|erol f o bisow ago r erut sov senas eg ad

Running in Docker

  • docker build -t go-make-log . - Build the Docker image
  • docker run go-make-log <args> - Run with the given arguments

Running Locally

  • go run ./main <args> - Run the main.go file with the given arguments

Run Unit Tests

  • go test ./... -count=1 - Run all unit tests

Arguments

Argument Description
-h | --help Print the help message
-l Add line number to each log event
-lt Log with timestamps (UTC)
-f <delimited|json> Output format (default delimited)
-o <filename> Output filename
-s <size> Minimum output size (default 1MiB)

go-make-log's People

Contributors

mikebd avatar

Watchers

 avatar  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.