Dashboards & Visualizations

Charting 2 different stats query

RonD
Explorer

I am trying to achieve a simple pie chart that will display from two different stats query command

| inputlookup records.csv where condition1=compliant | stats count(host) as compliant
| append records.csv where (condition2=noncompliant AND condition3=noncompliant and condition4=noncompliant)| stats count(host) as noncompliant
| <I am missing a command at this point in able to produce the pie chart below>


compliance.PNG

Please advise. Thanks and regards.

Labels (1)
0 Karma
1 Solution

s2_splunk
Splunk Employee
Splunk Employee

Here's one approach:

 

| inputlookup records.csv 
| eval status=if( (condition1="noncompliant") OR (condition2="noncompliant" AND condition3="noncompliant" AND condition4="noncompliant"),"NC","C") 
| stats count(host) by status

 

Screen Shot 2020-12-15 at 1.02.41 PM.png 

BTW, you don't need a 

stats count(host)

 because you are just counting records, so 

stats count

would also work.

 

View solution in original post

RonD
Explorer

Thanks, this worked.

0 Karma

s2_splunk
Splunk Employee
Splunk Employee

Here's one approach:

 

| inputlookup records.csv 
| eval status=if( (condition1="noncompliant") OR (condition2="noncompliant" AND condition3="noncompliant" AND condition4="noncompliant"),"NC","C") 
| stats count(host) by status

 

Screen Shot 2020-12-15 at 1.02.41 PM.png 

BTW, you don't need a 

stats count(host)

 because you are just counting records, so 

stats count

would also work.

 

Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

  Ready to master Kubernetes and cloud monitoring like the pros?Join Splunk’s Growth Engineering team for an ...

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...