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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...