Getting Data In

Time format having pipe "|"

saad_siddiqi
Path Finder

Hi There,

I am having trouble recognizing time format of %Y%m%d|%H%M%S (e.g. |20130813|235858 )

I have tried using the following settings in props.conf

TIME_PREFIX = \| 
TIME_FORMAT = %Y%m%d\|%H%M%S

and

TIME_PREFIX = \| 
TIME_FORMAT = %Y%m%d|%H%M%S

both not working.

Can anyone help me out here please.

Tags (2)
0 Karma
1 Solution

kristian_kolb
Ultra Champion

The docs on TIME_PREFIX can give some explanation;

TIME_PREFIX = <regular expression>
* If set, splunk scans the event text for a match for this regex in event text before attempting
to extract a timestamp.
* The timestamping algorithm only looks for a timestamp
in the text following the end of the
first regex match
.
* For example, if TIME_PREFIX is set to "abc123", only text following the first occurrence of the
text abc123 will be used for timestamp extraction
.

Perhaps something like this could work;

TIME_PREFIX = \|(?=\d{8})

Haven't tried it in Splunk, but it works in the excellent online regex tester found at

http://gskinner.com/RegExr/

View solution in original post

kristian_kolb
Ultra Champion

The docs on TIME_PREFIX can give some explanation;

TIME_PREFIX = <regular expression>
* If set, splunk scans the event text for a match for this regex in event text before attempting
to extract a timestamp.
* The timestamping algorithm only looks for a timestamp
in the text following the end of the
first regex match
.
* For example, if TIME_PREFIX is set to "abc123", only text following the first occurrence of the
text abc123 will be used for timestamp extraction
.

Perhaps something like this could work;

TIME_PREFIX = \|(?=\d{8})

Haven't tried it in Splunk, but it works in the excellent online regex tester found at

http://gskinner.com/RegExr/

linu1988
Champion

Yes working very well.

NO_BINARY_CHECK=1
SHOULD_LINEMERGE=false
TIME_FORMAT=%Y%m%d|%H%M%S
TIME_PREFIX=\|(?=\d{8})

0 Karma

saad_siddiqi
Path Finder

Thank you for looking into this

Below are some events
|CALLCONTROL|VMSIVR2|107|20130814|130224|130230|I
|CALLCONTROL|VMSIVR2|183|20130814|130224|130230|I
|CALLCONTROL|VMSIVR2|99|20130814|130124|130230|I
|PROVI|APS2|20130814|130240|
|PROVI|APS2|20130814|130253|
|SMSC|VMSIVR2||20130814|125501|
|SMSC|VMSIVR2||20130814|125511
|20130814|125959|202|12342|
|20130814|134950|203|12451|

Please note that the timestamp is moving here and there since this log is getting combined from various sources.

0 Karma

kristian_kolb
Ultra Champion

are there any other pipes before the one preceding the timestamp? Please post a few sample events.

0 Karma

linu1988
Champion

Does the log starts with the time field? Could you paste a little more of the log?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...