Splunk Search

set timezone in search

GeorgeStarkey
Path Finder

most of my data sets to UTC, and all data sources are properly tagged to convert to UTC if they are not.

My user is in PST, so when I run a search such as @d etc, it starts from midnight PST. Usually this is ok, as dashboards are built with this in mind.

I have an extra use case for monitoring our splunk license usage, Splunk however runs it's license metrics based on 0-24:00 UTC. Any search I run for "last day" is going to be off by 1/3 based on this time difference.

Is there a way to set a specific search to ignore the associated users search head timezone setting and run in UTC (or other specification) on that search?

Tags (2)
0 Karma

rrice_splunk
Splunk Employee
Splunk Employee

The following will convert from the timezone of your user account to UTC. You could use it in a subsearch to set earliest/latest in your search.

| makeresults
| eval myTime=_time
| eval showMyTime=strftime(myTime,"%H:%M")
| eval myZone=strftime(myTime,"%z")
| eval UTC=myTime-((myZone/100) *3600)
| eval showUTC=strftime(UTC,"%H:%M")

0 Karma

somesoni2
Revered Legend

Try something like in your searches to specify time range

your base search [| gentimes start=-1  | eval UTCOffset=strptime(strftime(now(),"%m/%d/%Y %H:%M:%S")." UTC","%m/%d/%Y %H:%M:%S %Z") - now() | addinfo  | eval earliest=info_min_time+UTCOffset | eval latest=info_max_time+UTCOffset | table earliest latest | format "" "" "" "" "' ""] | rest of the search
0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...