Getting Data In

How to configure timestamp to recognize multiline timestamp?

iljubicic
Engager

I am a new Splunk user and I am having difficulties resolving this problem. I have an xml log file as an input structured like this:

<LOG>
 <DATE>DDMMYYYY</DATE>
 <TIME>HHMMSS</TIME>
 <CC>\d{16}</CC>
 <AMOUNT>\d+\.\d{2}</AMOUNT>
</LOG>

where logs are separated with LOG tag. What do I need to do to make Splunk to correctly read the timestamp that is separated in the two lines (DATE and TIME)?

1 Solution

maciep
Champion

You'll need to configure props.conf at the parsing layer (probably on your indexer) appropriately. That includes creating a new stanza for your sourcetype and telling Splunk how to deal with the format.

http://docs.splunk.com/Documentation/Splunk/latest/admin/Propsconf

http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html

Something like this should work. Tell splunk to merge multiple lines into one event and where to break events. Then tell it where the timestamp is and what the format looks like.

[your sourcetype]
SHOULD_LINEMERGE = true
BREAK_ONLY_BEFORE = <LOG>
TIME_PREFIX = <DATE>
TIME_FORMAT = %d%m%Y</DATE>%n<TIME>%H%M%S

View solution in original post

maciep
Champion

You'll need to configure props.conf at the parsing layer (probably on your indexer) appropriately. That includes creating a new stanza for your sourcetype and telling Splunk how to deal with the format.

http://docs.splunk.com/Documentation/Splunk/latest/admin/Propsconf

http://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html

Something like this should work. Tell splunk to merge multiple lines into one event and where to break events. Then tell it where the timestamp is and what the format looks like.

[your sourcetype]
SHOULD_LINEMERGE = true
BREAK_ONLY_BEFORE = <LOG>
TIME_PREFIX = <DATE>
TIME_FORMAT = %d%m%Y</DATE>%n<TIME>%H%M%S
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...