[search] |stats count by ClientName Outcome
example:
Client1 Positive count
Client1 Negative count
Client2 Positive count
Client2 Negative count
Client 2 Unknown count
How do I get the percentage for each client outcomes?
Client1 Positive count %
Client1 Negative count %
Client2 Positive count %
Client2 Negative count %
Client2 Unknown count %
[search] |stats count by ClientName Outcome
| eventstats sum(count) as total by ClientName
| eval percent=100*count/total
[search] |stats count by ClientName Outcome
| eventstats sum(count) as total by ClientName
| eval percent=100*count/total
Don't understand what you mean. It does not do anything.
How do I get the result I am asking for?
What do you mean "it doesn't do anything"? Please share the search and the results
Oh, I see what I did, but not sure, why that works the way it does.
This is what I did:
[search] |stats count as EventCount by ClientName Outcome
| eventstats sum(EventCount) as total by ClientName
| eval percent=100*count/total
It works when I do what you said exactly!
Thanks!
Since you renamed the count field, you have to use the new name n the calculation
[search] |stats count as EventCount by ClientName Outcome
| eventstats sum(EventCount) as total by ClientName
| eval percent=100*EventCount/total