Splunk Search

Convert _time Timezone at Search Time

Path Finder

Some of the logs I am consuming have time stamps in GMT while my overall logging infrastructure is in EST. I am trying to do a comparison between the GMT timestamp in one log and the current time in EST. Is there any way to convert _time from EST to GMT using something like strftime at searchtime, so it can be more easily worked with? I understand there is a way to do this "overall" in Splunk, but I am more interested in doing a "one-off" timezone conversion if possible.

0 Karma

Champion

The best thing to do is set your time zone in your props file for each of your sources by sourcetype, host, or source. Then set your users time zone and Splunk will handle the rest, example below. The other option is to user strptime and strftime to do the math yourself.


#props.conf
[host::nyc*]
sourcetype = foo
SHOULD_LINEMERGE = True
TZ = US/Eastern

0 Karma

Splunk Employee
Splunk Employee

If the event has the wrong timestamp.timezone, it will never match your search time window. And you cannot change the TZ once indexed.
So use the previous method and reindex with a TZ.

0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!