Fakelogs

Fakelogs is a random log generator. It can be used for load testing of log parsers.

It is written in Rust and is mostly a toy project to ramp up on the language. It might however be useful. Use at your own risk.

Fakelogs icon

Status

Build Status

Current version is 0.1.6.

Install

No install target yet, copy the fakelogs binary in your $PATH if you wish, that's all.

A few commands which may prove useful:

sh cargo build # build debug binary in ./target/debug/ cargo build --release # build release binary in ./target/release/ cargo test # launch tests rustfmt src/*.rs # format code ./docker-build.sh # build Docker image with version tag ./bump-version.sh # bump minor version number

Usage

Simply launch:

cargo run

Or just run the binary directly:

./target/debug/fakelogs ./target/release/fakelogs

Alternatively, using docker:

docker run ufoot/fakelogs

To pass options:

cargo run -- --csv -100

By default, the generated lines follow the Apache common line format, so look like:

127.0.0.1 - james [09/May/2018:16:00:39 +0000] "GET /report HTTP/1.0" 200 123 127.0.0.1 - jill [09/May/2018:16:00:41 +0000] "GET /api/user HTTP/1.0" 200 234 127.0.0.1 - frank [09/May/2018:16:00:42 +0000] "POST /api/user HTTP/1.0" 200 34 127.0.0.1 - mary [09/May/2018:16:00:42 +0000] "POST /api/user HTTP/1.0" 503 12

There's a -c or --csv option, if you call fakelogs -c you get an alternate custom CSV format:

"10.0.0.4","-","apache",1549573860,"GET /api/user HTTP/1.0",200,1234

If you pass an integer after a dash, it defines the average number of lines per second. The default is 1000. Maximum is 1000000. Eg to change the output to 10000 lines per second:

fakelogs -10000

Other standard options include:

Logs content

The logs may look random, but they follow a few patterns:

License

Fakelogs is licensed under the MIT license.