Getting Data In

timestamp recognition in multi timestamp event

lukasz92
Communicator

Hi all!

I have a problem with my log. Some events have only one timestamp, some have two - as in this example : http://docs.splunk.com/Documentation/Splunk/6.2.1/Data/Configurepositionaltimestampextraction#Exampl...

How should I configure splunk to always match the latest timestamp in the event?
I could write regex, but I only can provide time PREFIX (TIME_PREFIX=...). If I write a TIME_PREFIX for two-timestamps-event - some events (with only one timestamp) will have incorrect time (time of indexing)

Tags (2)
0 Karma
1 Solution

lukasz92
Communicator

I solved my problem with using one, more complicated regex - with question mark match: ()?
TIME_PREFIX = (.*something123 (\[)?([^,]*, somethingother[^,]*,[^,]*, [^0-9]*)?)?
It was possible with my custom data.

@FritzWittwer
I haven't tried your solution, maybe it works.

I will keep the question open, for other ideas.

View solution in original post

0 Karma

lukasz92
Communicator

I solved my problem with using one, more complicated regex - with question mark match: ()?
TIME_PREFIX = (.*something123 (\[)?([^,]*, somethingother[^,]*,[^,]*, [^0-9]*)?)?
It was possible with my custom data.

@FritzWittwer
I haven't tried your solution, maybe it works.

I will keep the question open, for other ideas.

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Can you provide some samples of your events (mask sensitive information) with both single and double timestamp values.?

0 Karma

FritzWittwer
Contributor

I would try it with a regexp with a two alternatives, one with a positive look ahead (?=…second time stamp regexp…)so it only matches if there is a second timestamp, did not try it out, but I think this could work.

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 ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...