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 | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...