Splunk Search

I want create table view

abi2023
Path Finder

I have SPL
index=main state=open | stats count(state) as open by risk_rating | rename risk_rating as state | addtotals col=t row=f labelfield=state | append [ search index=main state=closed | stats count(state) as closed by risk_rating_after | rename risk_rating_after as state | addtotals col=t row=f labelfield=risk 

I want crate table like below but risk_rating_after field only has Sustainable value so when I do selfjoin state 
it only has sustainable. I try join but it did not get result. It any way I can achieve this result.  

Many thank you in advance. 


stateCritical ModerateSevereSustainableTotal
Open124512
Close00066

Total                              1                                   2                                   4                                   11                                18

Labels (3)
0 Karma

yeahnah
Motivator

Hi @abi2023 

This is a good example of using the chart command.  Here's a run anywhere example (based of dummy events derived from your example SPL)

| makeresults | eval _raw="state, risk_rating
open, Critical
open, Moderate
open, Severe
open, Sustainable
close, Critical
close, Moderate
close, Sustainable"
| multikv forceheader=1
| table state risk_rating
  ``` ^^^ above is just creating dummy example events ^^^ -> the SPL below creates the table output ```
| chart count OVER state BY risk_rating
| sort - state
| addtotals
| addcoltotals labelfield=state label="Total"

 Hope this helps

0 Karma
Get Updates on the Splunk Community!

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...

Join Us at the Builder Bar at .conf24 – Empowering Innovation and Collaboration

What is the Builder Bar? The Builder Bar is more than just a place; it's a hub of creativity, collaboration, ...

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...