Splunk Search

How to round a millisecond output?

heybails88
Path Finder

Does anyone know how to round a time readout from 00:07:06.53846153846155 to 00:07:06.54?

0 Karma
1 Solution

adonio
Ultra Champion

maybe like this:

| transaction node startswith="up_or_down=down" endswith="up_or_down=available"
| stats avg(duration) as avg_outage by node
| eval rounded_avg_outage = round(avg_outage, 2)
| eval MTTR = tostring(rounded_avg_outage, "duration)
| table node MTTR

hope it helps

View solution in original post

adonio
Ultra Champion

maybe like this:

| transaction node startswith="up_or_down=down" endswith="up_or_down=available"
| stats avg(duration) as avg_outage by node
| eval rounded_avg_outage = round(avg_outage, 2)
| eval MTTR = tostring(rounded_avg_outage, "duration)
| table node MTTR

hope it helps

heybails88
Path Finder

Excellent!! That worked. I appreciate it.

0 Karma

DalJeanis
SplunkTrust
SplunkTrust

What is the format of the underlying field? There are at least five different ways, but the efficiency will be based on the field format.

0 Karma

heybails88
Path Finder

Thanks for the response

Here's the base of the search with MTTR is the mean time to repair or average outage time averaged by duration. The "avg_outage" is epoch:

| transaction node startswith="up_or_down=down" endswith="up_or_down=available"
| stats avg(duration) as avg_outage by node
| eval MTTR=tostring(avg_outage, "duration")
| table node MTTR

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...