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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...