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!

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...