Splunk Search

Spl query for host downtime consolidation

Harikiranjammul
Explorer

I have a data like below

Servename     downtime

Web1               7 day 2 h

Web2                2 h 23 min

Web2               20 min

Web3.               17 min

 

Have  severname and downtime fields. Servernames can be same with different donwtime available.

 

How can I group this by servename by adding the downtimes in to single row of per server. Help us with spl query

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Is the downtime already / previously available as a numeric e.g. number of seconds? If not, you would have to convert it to a numeric by parsing the string into its constituent parts and multiply until you have the number of seconds. You can then use stats with the sum aggregation function to calculate the total downtime for each host.

0 Karma

Harikiranjammul
Explorer

Hi

 

I don't have the numeric field.

Any quick suggestion on converting this type of string to numeric field?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex field=downtime "((?<day>\d+)\sday\s?)?((?<hour>\d+)\sh\s?)?((?<minute>\d+)\smin\s?)?"
| fillnull value=0 day hour minute
| eval duration=((((day * 24) + hour) * 60) + minute) * 60
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...