I am trying to write a splunk search to pull what rules a particular user is hitting. This search is helping with that BUT everything is coming through as a urlrulelabel. When I move apprulelabel to the start of the line, everything comes through as an apprulelabel.
When I dive into the events, I see there are other rules showing, but they arent populating in the statistics table.
I would like to have each rule come through as its own.
index=zscaler sourcetype=zscalernss-web user=*
| eval rule_type=case(isnotnull(urlrulelabel), "urlurlelabel", isnotnull(apprulelabel), "apprulelabel", isnotnull(rulelabel), "rulelabel", true(), "unknown")
| eval rule=coalesce(apprulelabel, urlrulelabel, rulelabel)
| stats count by rule, rule_type
| rename rule as Rule, rule_type as "Type of Rule", count as "Hit Count"
| sort - "Hit Count"
Thank you in advance
Here is a picture of my results. Hoping to get some help into having the second column populate urlrulelabel, apprulelabel, and rulelabel policies rather than just one.
As @yuanliu says, you will have a much better chance of getting a useful answer if you follow some simple guidelines.
It is not possible to tell from what you have posted so far what your events actually look like (or a close anonymised representation of them), nor what it is you are trying to determine from your search.
For example, do all the rule fields have either "None" or a rule name in? If so, isnotnull() will always return true, hence all your rules are coming through as "urlurlelabel" (should this be "urlrulelabel"?)
Can there be more than one rule label you are interested in for an event or does apprulelabel always take presidence, even if it is "None", which is what your search is doing, hence the high count for "None"?
Please provide more relevant information (if you would like more help).
You'll have a much better chance of getting real help if you really follow this formula for an answerable question: