I have a query as below
| metadata type=hosts | search [| inputlookup hosts_test.csv | eval host=lower(my_hostname) | fields host ] | eval host=lower(host) | append [| inputlookup hosts_test.csv | eval host=lower(my_hostname) | eval recentTime=0, lastTime=0, host=lower(host) | fields host recentTime lastTime ] | dedup host | eval category=case(recentTime>=relative_time(now(), "-24h"), "Systems reported to Splunk in last 24 hours", (recentTime0), "Systems reported to Splunk more than 24 hours ago", recentTime=0, "Systems never reported to Splunk") | stats dc(host) as "Total Hosts" BY category
which displays the result as follows
category Total Hosts
Systems never reported to Splunk 91
Systems reported to Splunk in last 24 hours 1074
Systems reported to Splunk more than 24 hours ago 20
Now, how to display the percentage of each instead of dc count in the result?
↧