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 ...

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...