Splunk Search

Convert _time Timezone at Search Time

bcarr12
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

bmacias84
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

yannK
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
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...