Skip to content

WuerthPhoenix/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

Pattern file

A pattern file has many parameters.

Parameters Descriptions
name name of log
enabled enable/disable this pattern
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

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.