Working on some client data, sample data format looks like:
Item status
--------------------------
AAA success
BBB fail
CCC pending
DDD fail
EEE success
FFF success
GGG pending
HHH success
III fail
JJJ pending
KKK success
Now I want to calculate the percentage of each status field.
I want the output like below:
status count percentage
-----------------------------------
Success 50 50%
fail 40 40%
pending 10 10%
plz help me with search.
Thanks in advance..
try like this:
...| stats count by status| eventstats sum(count) as total| eval percent = round((count/total)*100) . " %"|sort -percent | fields - total
or
...| top status | eval percent=percent."%"
It should be something like:
yoursearch | top status
Examples in our docs here - http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Top