Splunk Search

convert time

martin61
Engager

I'm looking to convert the results for these fields  in PST time zone, so that I can fetch the events based on these fields but not based on the event timestamp. Below two fields are in GMT format. Please help

FIRST_FOUND_DATETIME="2021-12-12T08:30:29Z",
LAST_FOUND_DATETIME="2021-12-20T16:12:28Z

 

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Don't worry about it.  Once you convert the fields into epoch form so you can compare them they will be in epoch form.  When you then format them for display they'll be in your selected time zone.

For example:

index=foo
| eval First=strptime(FIRST_FOUND_DATETIME, "%Y-%m-%dT%H:%M:%S%Z"), Last=strptime(LAST_FOUND_DATETIME, "%Y-%m-%dT%H:%M:%S%Z")
| where First <= relative_time(now(), "-7d") AND Last <= relaive_time(now(), "-6d")
...
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

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