All Apps and Add-ons

how to calculate percentage in timechart by?

karthi2809
Builder

index=xxx|transaction transid startswith="Request" endswith="Response" Keeporphans=t |timechart avg((count(eval(Result="FAILURE"))/count(eval(OperationName)))) count as TotalCount count(eval(Result="SUCCESS")) as SuccessCnt count(eval(Result="FAILURE")) as FatalCnt by OperationName |eval FailurePercentage= (FatalCnt*100/TotalCount)

Tags (1)
0 Karma

cmerriman
Super Champion

Try this:

index=xxx|transaction transid startswith="Request" endswith="Response" Keeporphans=t |timechart avg((count(eval(Result="FAILURE"))/count(eval(OperationName)))) count as TotalCount count(eval(Result="SUCCESS")) as SuccessCnt count(eval(Result="FAILURE")) as FatalCnt by OperationName|foreach FatalCnt* [eval FailurePercentage<<MATCHSTR>>= ('<<FIELD>>'/'TotalCount<<MATCHSTR>>')*100]

doc on foreach:
http://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/Foreach

chimell
Motivator

Hi

Try this search code :

index=xxx|transaction transid startswith="Request" endswith="Response" Keeporphans=t |timechart avg((count(eval(Result="FAILURE"))/count(eval(OperationName))))  as TotalCount , count(eval(Result="SUCCESS")) as SuccessCnt , count(eval(Result="FAILURE")) as FatalCnt by OperationName |eval FailurePercentage= (FatalCnt/TotalCount)*100
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...