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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...