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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...