Getting Data In

How do I get Splunk to recognise epoch time?

himynamesdave
Contributor

I have a static JSON file (240k lines) I would like to index. Here's a the format:

{"name":"fuel_level","value":88.260948,"timestamp":1362061287.027000}
{"name":"fuel_level","value":88.260948,"timestamp":1362061287.035000}
{"name":"fuel_level","value":88.260948,"timestamp":1362061287.064000}
{"name":"fuel_level","value":88.260948,"timestamp":1362061287.098000}
{"name":"fuel_level","value":88.260948,"timestamp":1362061287.110000}
{"name":"fuel_level","value":88.260948,"timestamp":1362061287.143000}
{"name":"fuel_level","value":88.260948,"timestamp":1362061287.154000}
{"name":"fuel_level","value":88.260948,"timestamp":1362061287.177000}

In the data preview mode Splunk is assigning the timestamp based on the last time the file was changed, not the timestamp variable of the event.

How can I get Splunk (using 6) to recognise the timestamp of the event?

i've tried playing with the ../props.conf file based on previous answers but have been unsuccessful so far.

Tags (2)
0 Karma
1 Solution

adrianathome
Communicator

It would be helpful if you post the format that you tried in props.conf.

It should be as follows:

TIME_FORMAT = %s.%6N

View solution in original post

adrianathome
Communicator

It would be helpful if you post the format that you tried in props.conf.

It should be as follows:

TIME_FORMAT = %s.%6N

himynamesdave
Contributor

Thanks! This is what I was originally trying, my mistake was not declaring:

TIME_PREFIX="timestamp":

0 Karma

jtrucks
Splunk Employee
Splunk Employee

Check out props.conf docs and read the Timestamp extraction configuration section.

The likely answer is in this part:

TIME_FORMAT = <strptime-style format>
* Specifies a strptime format string to extract the date.
* strptime is an industry standard for designating time formats.
* For more information on strptime, see "Configure timestamp recognition" in
  the online documentation.
* TIME_FORMAT starts reading after the TIME_PREFIX. If both are specified, the TIME_PREFIX
  regex must match up to and including the character before the TIME_FORMAT date.
* For good results, the <strptime-style format> should describe the day of the year and the
  time of day.
* Defaults to empty.

This references the Configure timestamp recognition docs which should help you tons, especially the Enhanced strptime() support part.

--
Jesse Trucks
Minister of Magic
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...