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!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...