Sign inSign up

gnegri/lorem-ipsum.logger

By gnegri

Updated almost 7 years ago

Randomly logs some Lorem Ipsum lines. Forked from chentex/random-logger

Image
0

100K+

gnegri/lorem-ipsum.logger repository overview

random-logger

Docker image for a random log generator, based on Alpine Linux.

Changes from forked repo

Rrather than 4 equally-weighted static logs, it now will pull from a random combination of Lorem Ipsum and include a random IP as the host.

Params
  • -w Wait time between logs, in ms. Defaults to 1000.
  • -m Max logs to send before shutting down. By default, will run indefinitely.
  • -f Format for logging. Not case sensitive.
    • C or CSV
      • 2019-11-01T20:01:05+0000,76.223.138.217,DEBUG,Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    • J or JSON
      • {"DATE": "2019-11-01T20:00:55+0000", "HOST": "16.200.135.116", "LEVEL": "INFO", "MESSAGE": "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."}
    • Omit for raw logs.
      • 2019-11-01T19:56:47+0000 26.41.228.110 ERROR Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  • -v Verbosity of logging. Not case sensitive.
    • 1 or E or ERR or ERROR: Weight 1
    • 2 or W or WARN: Weight 1
    • 5 or I or INFO: Weight 3
    • 10 or D or DEBUG: Weight 5
Usage
git clone git clone https://github.com/gnegri/random-logger.git
cd random-logger
name="rand"
docker build -f Dockerfile -t ${name} . && docker kill ${name}; docker rm ${name}; docker run --name ${name} ${name} -m 3
docker logs ${name}
  • Clone the repo and enter it
  • set a name for the image and container
  • Build the docker image
  • Clear out any old containers using the name we are about to use
  • Run the image as a container for 3 logs.
  • Access the logs via docker

Old Info from Forked Repo

What is this?

This image will execute a container which will generate four random log messages:

  • 2018-03-02T22:33:27-06:00 ERROR An error is usually an exception that has been caught and not handled.
  • 2018-03-02T22:33:27-06:00 INFO This is less important than debug log and is often used to provide context in the current task.
  • 2018-03-02T22:33:27-06:00 WARN A warning that should be ignored is usually at this level and should be actionable.
  • 2018-03-02T22:33:27-06:00 DEBUG This is a debug log that shows a log that can be ignored.

Why this Image?

I've had the necessity to create a random logger to test log configurations with containers, this helped me out to do it easily.

What is inside of this repo?

In this git repository you will find the docker image definitions for the random Logger for Alpine Linux

  • Dockerfile -> Contains image definition.
  • entrypoint.sh -> Shell code to generate log messages.

How do I use this image?

To use this image you must do as follows:

# you can use tags latest
docker pull chentex/random-logger:latest

# use different intervals to print logs every random(100, 400) milliseconds
docker run chentex/random-logger:latest 100 400

# use the third parameter so limit the number of loglines (after generating the lines the container will stop).
# if not set it runs infinite
docker run chentex/random-logger:latest 100 400 100

# to run the image just execute
docker run -d chentex/random-logger:latest

You will have now a docker container running and generating log messages, locate it running:

docker ps

You can see the logs using this command

docker logs <- container-id ->

How do I build this images?

First things first, you can find these docker images in chentex/random-logger but you can also build a specific version on your own, you only need:

  • docker
  • git

Clone this repo

git clone https://github.com/chentex/random-logger.git

Go to the folder in your terminal and type this:

# cd into folder
cd random-logger
# Then build the new image
docker build -f Dockerfile .

If you want to tag your image use the following command

docker build -f Dockerfile -t yourbase/yourname:version .

For more on docker build reference to the Documentation

You can get the source from the image in the Repository

Tag summary

Content type

Image

Digest

Size

3.2 MB

Last updated

almost 7 years ago

docker pull gnegri/lorem-ipsum.logger