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!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...