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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...