Hi,
I am using a query that uses the awesome percentage value feature built into stats. It outputs into a table that my coworkers get in a report. They love the report but they hate the formatting. This has lead me to two issues:
1) I have managed to figure out how to round most of the values into easily readable formats, but when I try and round the percentage outputs using feildformat they come back blank. Below is an example where I have tried a feildformat on 99% but not on 95%. 99% disappears There is no need for that decimal point at all, how can i get rid of it while keeping the output? Note: the values are for a duration and are indeed all numerical.
95%Ms 99%Ms
2000.0000
2) Looking at the same example above my coworkers really want commas in the larger numbers, when i run this query for anything more than a few hours the total cost is in the billions. So i tried using the tostring(bytes, "commas") strategy to break up the numbers, but this ruins the table because I am no longer able to sort by total cost. Splunk seems to only want to account for the values before the first comma so 600,000 will be sorted right below 601,987,543,123.
Here is the search i use:
eventtype="Event"
| stats min(xtime) as Min, avg(xtime) as AvgDuration, median(xtime) as Median, p95(xtime) as 95%Ms,
p99(xtime) as 99%Ms, max(xtime) as Max, count(xmethod) as NumCalls , sum(xtime) as TotalCost
by xmethod
| eval TotalCost = (NumCalls * AvgDuration)
| fieldformat Min=round(Min)
| fieldformat AvgDuration=round(AvgDuration)
| fieldformat 99%Ms=round(99%Ms)
| fieldformat Median=round(Median)
| fieldformat Max=round(Max)
| fieldformat TotalCost=round(TotalCost)
| sort -TotalCost | head 20
Thank you so much for all your help doing my job for me!
Splunk is the best!
... View more