Splunk Search

Correct REGEX for separating TIMESTAMP - val1;val2;val1;val2;.....

zachary_hickman
Explorer

Hello,

I have data that appears in this format:

TIMESTAMP VAL1;VAL2; VAL1;VAL2

I want Splunk to interpret the data as such:

TIMESTAMP VAL1;VAL2;,

TIMESTAMP VAL1;VAL2;,

basically so that each combo of val1 and val2 is considered one event, and the timestamp applies to each of those events. I assume I need to use a certain regex pattern to separate events, but I do not know how to do this, especially with that timestamp at the beginning.

Tags (3)
0 Karma
1 Solution

Rob
Splunk Employee
Splunk Employee

I think what you are looking for is to use the line breaker to break up the events.

http://docs.splunk.com/Documentation/Splunk/5.0.2/Data/Indexmulti-lineevents

The problem is that when you break up the line, it may not maintain the time stamp as Splunk will look for another timestamp after the break. So this might be less than ideal depending on what you are looking to do with your data. It might be better to reformat the source data to have a timestamp with each key value pair. Otherwise, you may want to take a look at the search language to provide you with different ways to format your data from values in a single event.

View solution in original post

0 Karma

Rob
Splunk Employee
Splunk Employee

I think what you are looking for is to use the line breaker to break up the events.

http://docs.splunk.com/Documentation/Splunk/5.0.2/Data/Indexmulti-lineevents

The problem is that when you break up the line, it may not maintain the time stamp as Splunk will look for another timestamp after the break. So this might be less than ideal depending on what you are looking to do with your data. It might be better to reformat the source data to have a timestamp with each key value pair. Otherwise, you may want to take a look at the search language to provide you with different ways to format your data from values in a single event.

0 Karma

zachary_hickman
Explorer

The regex that works on a regex tester is [A-Za-z0-9]+;\d+;, but this does not work when trying to event break.

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...