Skip to content

m-a-leclercq/log-generator

 
 

Repository files navigation

Build Status PyPI version

Random Log Generator

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.

Install

Clone repository

git clone https://github.com/WuerthPhoenix/log-generator.git

and install with setup.py:

cd log-generator

python setup.py install

or use pip:

pip install rlog-generator

Docker

Clone repository

git clone https://github.com/WuerthPhoenix/log-generator.git

build docker

docker build -t log-generator:latest .

and use it

docker run -v `pwd`/conf/:/root/.config/rlog_generator/ log-generator

Pattern file

A pattern file has many parameters.

Parameters Descriptions
name name of log
enabled enable/disable this pattern
stdout log to stdout instead of file
path path where store the log
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 address
  • func_randint: generate a random integer from min to max
  • func_randmac: generate a random MAC address
  • func_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.

Command line

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.

Features

  • Random logging from template
  • Template can be a list of more formats

TODO

  • Generate logs from raw examples

Apache 2 Open Source License

This tool can be downloaded, used, and modified free of charge. It is available under the Apache 2 license.

About

Random Log Generation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 91.5%
  • Makefile 8.0%
  • Dockerfile 0.5%