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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...