Splunk Search

How can we exclude weekends from the count of the number of days for the age of a ticket?

splunker9999
Path Finder

Hi ,

We have a field called AGING which tells how many days a ticket exists.

In order to get the accurate age, we want to subtract weekends from the AGING field.

For example: If aging has value of 30 days, we need to exclude all Saturdays and Sundays from these 30 days and need to output the results.

Can you please help?

Thanks.

0 Karma

sundareshr
Legend

Try this

... | eval end=_time | eval start=end-(aging*86400)| eval range=mvrange(start, end, 86400) | convert ctime(range) timeformat="%+" | eval BusinessDays=mvcount(mvfilter(NOT match(range,"(Sun|Sat).*"))) 

woodcock
Esteemed Legend

Brilliant; I learned mvrange today!

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...