hello
thanks for all your help
how can I calculate the percent of size base on the data
size<1024 2048<size >1024 size >2048
index=maillog size=*
| stats count(eval(size<1024)) as "<1024" count(eval(size>1024 AND size<2048)) as "1024> & <2028" count(eval(size>2048)) as ">2048"
| transpose column_name="size_range"
| rename "row 1" as count
thanks again
@fzfengzhuang this seems to be a duplicate question of https://answers.splunk.com/answers/641469/how-to-do-a-pie-chart.html
Could you please confirm?
Hello,
Try this,
index=maillog size=*
| stats count(eval(size<1024)) as "val1" count(eval(size>=1024 AND size<2048)) as "val2" count(eval(size>=2048)) as val3 count as tot
| eval perc1=round(100*val1/tot), perc2=round(100*val2/tot), perc3=round(100*val3/tot)
| transpose column_name="size_range" | rename "row 1" as count
Or This:
index=maillog size=*
| stats count(eval(size<1024)) as "val1" count(eval(size>=1024 AND size<2048)) as "val2" count(eval(size>=2048)) as val3
| transpose column_name="size_range"
| rename "row 1" as row1
| eventstats sum(row1) as total
| eval row1=round(100*row1/total)
| transpose column_name="size_range" | rename "row 1" as count
hello there,
please try this search anywhere:
| makeresults count=1
| eval size="1025,1000,2000,3000,500,5000,200,4000,2100,3001,800,100,2048"
| makemv delim="," size
| mvexpand size
| stats count as event_count count(eval(size<1024)) as less_than count(eval(size>1024 AND size<2048)) as in_between count(eval(size>2048)) as greater_than
| eval percent_less = round(less_than/event_count*100, 2), percent_in_between = round(in_between/event_count*100, 2), percent_greater_than = round(greater_than/event_count*100, 2)
see screenshot below:
note, see how it does not count the value "2048" as it is equal (not greater or lesser than) so you can add that rule as you see fit
hope it helps