Splunk Search

Duration With Just days

Oisin77
Explorer

I know that if you use duration it gives the days but it also gives the hours, minutes, etc. I want just the days. The numbers to be converted are in mini seconds.

Tags (3)
0 Karma
1 Solution

gfuente
Motivator

Hello

If you are getting durations like this:

"1+06:29:32"

You can use rex after getting the duration to extract the day. Like:

...| rex field="yourdurationfield" "(?<durationdays>^\d+)\+" | ...

But, for durations of less than one day you won't get any value. You will need to use fillnull after the rex command.

Regards

View solution in original post

gfuente
Motivator

Hello

If you are getting durations like this:

"1+06:29:32"

You can use rex after getting the duration to extract the day. Like:

...| rex field="yourdurationfield" "(?<durationdays>^\d+)\+" | ...

But, for durations of less than one day you won't get any value. You will need to use fillnull after the rex command.

Regards

Oisin77
Explorer

Awesome,that worked, thanks.

0 Karma
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...