-1

I am new in splunk and only have a basic knowledge in querying. I need to create a dashboard that will count the total number of policy for each server. I have an example data, it shows the different host and policy.

Example data:

enter image description here

I want to generate a dashboard like this: enter image description here

My code is like this:

eval search if("$Host$"="AAA") | stats count(Policy) as "AAA" by Policy |
eval search if("$Host$"="BBB") | stats count(Policy) as "BBB" by Policy |
eval search if("$Host$"="CCC") | stats count(Policy) as "CCC" by Policy |
hannah
  • 41
  • 7

1 Answers1

2

stats is a filtering command so Host values are lost to subsequent eval statements. Try this query, instead:

... | stats count by Host, Policy | addcoltotals
RichG
  • 9,063
  • 2
  • 18
  • 29