Splunk Search

Seperate One Event into Multiple Events

sir_reel
Explorer

Need some help breaking an event out into multiple events.

For example the following event:

 7368:20130826:133019.286 status
 7368:20130826:133019.389 status
 7368:20130826:133019.414 status
 7368:20130826:133019.433 status

The format is pid:date/timestamp space status

I have tried adding the following things to the indexer:

props.conf:

[sourcetype]
SHOULD_LINEMERGE = false
LINE_BREAKER = (\d+:%Y%m%d:%H%M%S.%3N\s)([\r\n])

and

MUST_BREAK_AFTER = (\d+:%Y%m%d:%H%M%S.%3N\s)|([\r\n])

Neither of the above seems to have any effect either good or bad on the data even after restarting the service.

What I want is everytime splunk encounters the above format of pid:date/timestamp it creates a new event.

Splunk does seem to be matching the date/timestamps up correctly it just seems to lump all the events under the one event.

Since I'm new to both splunk and regex expressions I'm not sure the best way to go about this.

1 Solution

kristian_kolb
Ultra Champion

Assuming that all events in the log file follow this format you should configure like so;

props.conf

[your_sourcetype_here]
SHOULD_LINEMERGE = false
TIME_PREFIX = :
TIME_FORMAT = %Y%m%d:%H%M%S.%3N

SHOULD_LINEMERGE = false implies that all events are single-line, and you should not need to specify any LINE_BREAKER.

MUST_NOT_BREAK_AFTER and similar BREAK_ONLY_BEFORE... etc are only relevant when SHOULD_LINEMERGE = true

Hope this helps,

K

View solution in original post

kristian_kolb
Ultra Champion

Assuming that all events in the log file follow this format you should configure like so;

props.conf

[your_sourcetype_here]
SHOULD_LINEMERGE = false
TIME_PREFIX = :
TIME_FORMAT = %Y%m%d:%H%M%S.%3N

SHOULD_LINEMERGE = false implies that all events are single-line, and you should not need to specify any LINE_BREAKER.

MUST_NOT_BREAK_AFTER and similar BREAK_ONLY_BEFORE... etc are only relevant when SHOULD_LINEMERGE = true

Hope this helps,

K

sir_reel
Explorer

This worked perfectly, thanks Kristian.

0 Karma

sir_reel
Explorer

Can this still be used if not all entries in the log file follow that format?

There are some entries that do not have a clear date/time stamp. I am not as concerned that those get separated out properly as I am that every time splunk hits the above date/time stamp it creates a new event.

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!

How much can you really learn in 3 minutes?

Observability can certainly be hard to understand – there's a lot of jargon and buzzwords and it seems to ...

Event Series: The Agentic SOC: Trust Before Autonomy

AI is fundamentally changing security operations, but true progress requires more than just automation—it ...

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...