chentex / random-logger

Docker image for a random log generator.
MIT License
121 stars 103 forks source link

Feature request: print unique random tags #14

Open qingvincentyin opened 3 years ago

qingvincentyin commented 3 years ago

I've come across your Docker image. It's very handy.

A feature request:

All the messages currently consist of very common words, and the entire sentence is fixed and repeated. When they are mixed with tons of other applications' logs in a data lake (e.g., in Elasticsearch, Datadog, Splunk, etc.), it is very hard to query for a particular message from your running container.

So, why not append each message with a dynamically generated random string -- each log line has a different, unique string. That will give the best of both worlds:

  1. You can query for the fixed part of your current message in order to get all messages from your particular container.
  2. You can also query for that random string to pinpoint a particular occurrence of a message.
chentex commented 3 years ago

Thank you for your interest, this sounds like a interesting feature to implement. if I understand correctly it would be nice to have something like this:

2018-03-02T22:33:27-06:00 ERROR <random-string>
2018-03-02T22:33:27-06:00 INFO <random-string>
2018-03-02T22:33:27-06:00 WARN <random-string>
2018-03-02T22:33:27-06:00 DEBUG <random-string>
qingvincentyin commented 3 years ago

Correct.

qingvincentyin commented 3 years ago

You also want a fixed portion of string per line. So, not the entire message body is a random string, but more like:

2018-03-02T22:33:27-06:00 ERROR An error is usually an exception <random-string>
2018-03-02T22:33:27-06:00 INFO  This is less important than debug <random-string>
...

That way, I can search by either the fixed portion of the log line, or the unique-per-line random string.