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!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...