Getting Data In

how to convert datetime from UTC to ET in search results

dhavamanis
Builder

we have indexed data in UTC format and want to display in the search results stats as ET zone. Can you please provide some example.

index="myindex" earliest=-24h latest=now| stats count by date_month,date_mday,date_hour | sort count desc

In the above query giving results in UTC format results and we want to convert show as ET zone.

Tags (2)
1 Solution

somesoni2
Revered Legend

Assuming your local timezone is UTC (as the search results displays it). Try this

index=myindex earliest=-24h latest=now | eval EST_time=strptime(strftime(_time,"%m/%d/%Y %H:%M:%S EST"),"%m/%d/%Y %H:%M:%S %Z") | eval date_month=strftime(EST_time,"%m") | eval date_mday=strftime(EST_time,"%d") | eval date_hour=strftime(EST_time,"%H")| stats count by date_month,date_mday,date_hour | sort count desc

View solution in original post

somesoni2
Revered Legend

Assuming your local timezone is UTC (as the search results displays it). Try this

index=myindex earliest=-24h latest=now | eval EST_time=strptime(strftime(_time,"%m/%d/%Y %H:%M:%S EST"),"%m/%d/%Y %H:%M:%S %Z") | eval date_month=strftime(EST_time,"%m") | eval date_mday=strftime(EST_time,"%d") | eval date_hour=strftime(EST_time,"%H")| stats count by date_month,date_mday,date_hour | sort count desc
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...