Splunk Search

Trellis Search

JanetLong
Engager

Splunk's VisualizationTrellis documentation page shows example searches for things like count by sourcetype, and later shows trellis-ed visualizations for multi-value items, but there are no example searches for them. 

My data looks like this...

{
   audit: {
     audit_enabled: Compliant,  
     control_access: NotCompliant,
     firewall_on: NotCompliant, 
     etc: ... 
   }

}

I can create separate searches for each item in audit {} like this...

source=device_audit 
| stats count by audit.audit_enabled

But there are many audit items. I'd like to trellis pie charts for each audit item without creating a separate search for each. 

Is there are search I can use to trellis to produce three pie charts to show the split between compliant and notCompliant for each of the audit items (audit_enabled/control_access/firewall_on)?

Thank you. 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

The part before the blank lines sets up some dummy data and should be replace with your search

| makeresults count=100
| eval _raw="{\"audit\":{\"audit_enabled\":\"".mvindex(split("Not|","|"),random()%2)."Compliant\",\"controlled_access\":\"".mvindex(split("Not|","|"),random()%2)."Compliant\",\"firewall_on\":\"".mvindex(split("Not|","|"),random()%2)."Compliant\"}}"


| spath
| fields - _raw
| untable _time audit state
| stats count by audit state

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

The part before the blank lines sets up some dummy data and should be replace with your search

| makeresults count=100
| eval _raw="{\"audit\":{\"audit_enabled\":\"".mvindex(split("Not|","|"),random()%2)."Compliant\",\"controlled_access\":\"".mvindex(split("Not|","|"),random()%2)."Compliant\",\"firewall_on\":\"".mvindex(split("Not|","|"),random()%2)."Compliant\"}}"


| spath
| fields - _raw
| untable _time audit state
| stats count by audit state

JanetLong
Engager

Brilliant. Thanks... I learned a lot from picking that apart. 

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...