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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...

Keep the Learning Going with the New Best of .conf Hub

Hello Splunkers, With .conf26 getting closer, there’s already a lot of excitement building around this year’s ...