Getting Data In

How to assign timestamp for an event from two different fields

ankithreddy777
Contributor

I have an event like

"abcabcabc....abc..timestamp:-2017-05-05T*08:08:08.987.....abc...abc.....date:-2017-05-03*......""

I need to assign _time where date should be extracted from date field and time value should be extracted from timestamp field.
Is there any possibility.

If I need to use datatime_renamed.xml , where I should place this new resulting file. Does this effect existing settings on other indexes.

Tags (1)
0 Karma

jkat54
SplunkTrust
SplunkTrust
| rex "(?<time>\d{2}:\d{2}:\d{2}\.\d{3})" 
| rex "date:-(?<date>\d{4}-\d{2}-\d{2})"
| eval datetime=strftime(date."T".time, "%FT%T.%3N")
| table datetime

adonio
Ultra Champion

Beautiful,
regarding the second part of the question, @jkat54 used the erx command to extract the timeestamp which means its at search time. it will not affect other settings

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...