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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...