Splunk Search

Logging Best Practises, non key=value pair

pjhawar
New Member

We generally follow a pattern of logging in a key=value pattern.

I am curious if we should totally avoid logs that are not in that format. Is it not recommended to have logs like:

 

 

 

log.info("Flushing kafka buffer before callback.");

 

 

 

 

Tags (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

As with almost every such general question - it depends. Generally, you want to have a standardized and consistent log format so that you can easily extract field values.

It might also be a bit easier to remember that you need to search for something like "module=callback action=flush" instead of the particular wording of this exact message. But if you need to review the logs manually however, you might want to have a verbose log because it's easier human-readable.

The best of both worlds would be to have both - structured form and a free-form message but that increases storage usage (and in Splunk's case license consumption)

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

when I am writing logging guidelines/policies I always recommend to use standard format at 1st part of log. Then you should have some system specific part which also should standardize as much as possible inside same systems. That way it’s much easier and even possible to create continuous audit trail over customer transactions/sessions. That is much more important than are there some known kv pairs written in log events. Of course if/when you are using log files by dashboards, reports and alerts you could/should decrease the space of events as much as possible to save license costs. But if there are many people who are not familiar with your logs then it’s much easier that those contains also keywords to help to understand those.

r. Ismo

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If the logged events follow a defined pattern, not necessarily key=value, they can be ingested and use regular expressions (regex) to extract the data into fields. For example:

log.info\(\"(?<loginfo>[^\"]+)\"\)\;
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...