Splunk Search

How to extract date YYYYMMDD from _time?

royimad
Builder

How to extract date YYYYMMDD from _time?

Tags (1)
1 Solution

Damien_Dallimor
Ultra Champion
... | eval mytime=strftime(_time, "%Y%m%d") | table mytime

View solution in original post

nandipatisunil
Path Finder

How do i get this treated as date again?
I was using the above eval to get just the date out (ignoring the time) ... but i see that the string extracted is treated as a number when i graph it.

How do i get it converted back to date?

eg: i have events with different timestamp and the same date. I want to group them based on the date by ignoring the timestamp on it.

0 Karma

kristian_kolb
Ultra Champion

with strptime;

...| eval my_new_time = strptime(mytime, "%Y%m%d")

/k

0 Karma

Damien_Dallimor
Ultra Champion
... | eval mytime=strftime(_time, "%Y%m%d") | table mytime
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...