Splunk Search

Custom _time extraction

responsys_cm
Builder

I would like to use a field in my event data for the _time field. It looks like:

<LAST_UPDATE><![CDATA[2012-06-14T21:16:28Z]]></LAST_UPDATE>

I tried the following in props.conf to extract that time field:

TIME_PREFIX = (?i)^\s+\<LAST_UPDATE\>\<!\[CDATA\[

How can I make use this field for the _time value?

Thx.

Craig

Tags (1)
0 Karma

responsys_cm
Builder

Thanks, Ayn. Yeah, that's what the line of XML looks like. The characters appear like they do in the event.

0 Karma

sowings
Splunk Employee
Splunk Employee

It might be the \s+ at the beginning tripping up the regex.

You might also consider adding a TIME_PREFIX to give Splunk a leg up on guessing the proper format for your events.

Another possibility is that your time stamp string might be past the default "how far ahead do I look?" limit. That default is 150 characters, and is set by MAX_TIMESTAMP_LOOKAHEAD in props.conf.

Finally, if the event stream for this event contains other events that are in say, standard syslog format, with a timestamp at the leading position in the line, Splunk might "home in" on that timestamp format, preferring it over the one you've specified here. In general, you should try to group events with similar timestamp formats into like inputs. That is, if events A B and C all go into the same file monitored by inputs.conf, and only type C has the "different" timestamps, Splunk choose the format of events A and B, but be confused by C. You might have to resort to a search-time extraction, if this is the case.

Ayn
Legend

I reformatted your question a bit, but I'm unsure what you actually put in your regex and what you entered here to have the site display it correctly. Code blocks are indented with 4 spaces. Please have a look and edit it so it looks like it does in your events and conf files.

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!

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...

Splunk Developers: Construct Your Future at the .conf26 Builder Bar

Calling all Splunk architects, platform admins, and app developers: the site is open, and the blueprints are ...

Quick connection discovery mode for forwarders

When a Splunk forwarder loses connectivity to its indexers, it does not always reconnect immediately. In many ...