Splunk Search

When creating data type, Splunk fails to find the correct timestamp to use.

teward001
Path Finder

I'm trying to make a datatype for a specific kind of CSV data seen by Splunk. Here's an example of the individual data that Splunk sees, stored as CSV for importing:

# address,alternativeid,alternativeid_restriction,asn,asn_desc,assessment,cc,confidence,description,detecttime,guid,id,portlist,prefix,protocol,purpose,rdata,relatedid,relatedid_restriction,reporttime,restriction,rir,severity
1.2.3.4,some-url-here,public,1234,Description of 1234,scanner,CN,85,ssh,2014-04-23T04:27:21Z,everyone,1acb6224-dde9-4465-a34c-32283a130c00,22,1.2.3.0/18,6,mitigation,,,,2014-04-23T02:31:15Z,need-to-know,APNIC,medium

There are two timestamps, here. When using this regex, it finds the second timestamp: \d\d\d\d-\d\d-\d\d[A-Z]\d\d:\d\d:\d\dZ

What I need it to do is to read the first timestamp, which is the detection time for that specific data rather than the reported time for it. Can anyone help me figure out how to make Splunk detect the first timestamp, and only that first timestamp? Note that where it says "ssh" it will not always be "ssh" so you can't use that as part of the detection.

Tags (2)
0 Karma
1 Solution

dmaislin_splunk
Splunk Employee
Splunk Employee

props.conf

TIME_PREFIX = ^(.*?,){9}
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
MAX_TIMESTAMP_LOOKAHEAD = 20

View solution in original post

dmaislin_splunk
Splunk Employee
Splunk Employee

props.conf

TIME_PREFIX = ^(.*?,){9}
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
MAX_TIMESTAMP_LOOKAHEAD = 20

teward001
Path Finder

Works perfectly, thanks again!

0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee

Also, check out: http://docs.splunk.com/Documentation/Splunk/6.0.3/Admin/Propsconf for the section entitled: Structured Data Header Extraction and configuration. There are many new options for handling csv data where you can throw out the header, manage the column names, etc.

0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee

Updated the regex above to match the requirement. I didn't know that you had examples where nothing would be between the commas.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

That doesn't get caught because the regex requires a char between the commas. Replace the plus with an asterisk.

0 Karma

teward001
Path Finder

I could, if the system would accept the bloody captcha entry... >.< 91.121.201.180,not-a-url//blah.foo.bar/lists/date_all.txt,public,,,scanner,,85,ssh,2014-04-22T11:46:41Z,everyone,44e05139-a0d2-492a-b9bf-674daf81194e,22,,6,mitigation,,,,2014-04-23T02:31:30Z,need-to-know,,medium is an example of something that's not caught.

0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee

The regex searches past the 9th comma and does not care about the word SSH or anything specific. Can you update the sample log with a few lines where the answer does not work for you?

0 Karma

teward001
Path Finder

There's an anomaly in some of the data, and I've added that to the question for additional help if you can give it. Otherwise, this works perfectly.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...