Generator of random logs for multiple types of technologies.
This tool can generate all kinds of logs starting from templates. You should create a pattern file in YAML format foreach log that you want to generate, like in conf/patterns examples.
If more than one patterns are specified in patterns folder, all logs are generated in parallel. It's possible to generate 100 logs in parallel.
Clone repository
git clone https://github.com/fred-maussion/log-generator.git
and install with setup.py
:
cd log-generator
python setup.py install
You can use the prebuild docker for now only available for develop branch until project is stable
docker pull ghcr.io/fred-maussion/log-generator:develop
and use it
docker run -v `pwd`/conf/:/root/.config/rlog_generator/ -v `pwd`/logs:/logs/ ghcr.io/fred-maussion/log-generator:develop
Clone repository
git clone https://github.com/fred_maussion/log-generator.git
modify and then build docker
docker build -t log-generator:latest .
and use it
docker run -v `pwd`/conf/:/root/.config/rlog_generator/ -v `pwd`/logs:/logs/ log-generator
A pattern file has many parameters.
Parameters | Descriptions |
---|---|
name | name of log |
enabled | enable/disable this pattern |
locale | generate localized content |
stdout | log to stdout |
elastic | log to elastic |
log_output | log to stdout |
path | path where store the log |
remove_file | remove log file before writing into it |
eps | number of logs per seconds that will be generate |
correction | eps correction percentage |
time_period | how many seconds the generating is active |
generator_type | you can choose which generator use. The common value is template , that generate the logs from a template |
examples | logs of examples |
template | template to use to generate logs |
fields | fields used in template |
We can have two kinds of fields:
- list: the list fields are used to generate random values from a given list
- func: the func fields enable functions to generate the random values.
The func
fields start with func_
and then have the name of function. It can also have parameters.
The func
developed are:
func_randip
: generate a random ip addressfunc_randint
: generate a random integer from min to maxfunc_randmac
: generate a random MAC addressfunc_randuuid
: generate a random UUID address
For more details see the examples in folder conf/patterns.
If you want to contribute with real templates, add them in patterns folder.
The installation stores on system the rlog-generator
command line.
$ rlog-generator --help
Usage: rlog-generator [OPTIONS]
Random Logs Generator Tool.
Options:
-p, --patterns TEXT Path all log patterns files (only *.yml)
[default: ~/.config/rlog_generator/patterns]
-m, --max-concur-req INTEGER Max concurrent logs generating [default: 10]
-l, --log-level [CRITICAL|ERROR|WARNING|INFO|DEBUG|NOTSET]
Log level on stdout [default: WARNING]
--progress-bar / --no-progress-bar
Enable/Disable progress bar [default: False]
--help Show this message and exit.
- Random logging from template
- Template can be a list of more formats
- Generate logs from raw examples
This tool can be downloaded, used, and modified free of charge. It is available under the Apache 2 license.