Splunk Search

Timezone query to modify _time field if the user's timezone is not UTC.

waltz
Explorer

I have a dropdown in my dashboard where I provide static label and value for 4 timezones as of now(UTC,ET,PST,CT) (Which maybe increased in future). Now, Upon choosing a timezone value from the dropdown, I will have to adjust _time in a search query(of a panel/input in my dashboard) like this--> "mysearch" | eval _time = _time (+ or - ) (x*60*60) | "rest of mysearch" (If I'm right, this approach is correct if the current user's timezone is set to UTC). But, the currently logged in user's timezone maybe any among UTC,ET,PST,CT. So, I will be overriding the timezone configured in the settings. How can I modify my search query for _time field dynamically taking into account the user's current timezone and considering daylight savings time for the above mentioned timezones as well ?

0 Karma

cmerriman
Super Champion

if you do some evaluating, you should be able to put it all into UTC first.

|convert ctime(_time) as date timeformat="%Y-%m-%d"|eval _time=strptime(date,"%Y-%m-%d")
0 Karma

waltz
Explorer

I understand the approach you're suggesting @cmerriman, but I'm afraid this query does not exactly satisfy my requirement. Also, Thanks for the answer.

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 ...