Splunk Search

fill the table

Learnersplunk21
Engager

Hi All

Below is my query to tabulate a few fields together and count them on basis of its value .I need help with a situation when there is no data available at all , in the current setup , this table wont come up if there is no data coming from source , it generates only when data is coming in index. Using apendpipe i am trying to show 0's everywhere and generate this table in case of no data from backend .Currently it fills up 0's in the missing empty field when there is some data. I am trying to handle a situation when there is no data  , i dont want to use makeresults as the interpretation needed is no data means "No issue"  from backend and hence showing 0's as no issues found, only when  is there is an issue ,the numbers populate in the table.

We dont want to show blank hence filling up with 0's and showing the table is the requirement.Please help with rectification.

 

 

search (metric_label="*** Resource Health : Service Issue" OR metric_label="***Service Health : Service Issue") AND metric_value IN (300, 500)
| eval Service = mvindex(split(source_host," : "),1), Region = mvindex(split(source_host," : "),2)
| table metric_value Region Service Resources

 

| stats distinct_count(Region) as Region distinct_count(Service) as Service distinct_count(Resources) as Resources by metric_value
| eval Impact = case(metric_value=100,"Info",metric_value=200,"NA",metric_value=300,"Warning",metric_value=500,"Critical")
| fields - metric_value

 

| transpose column_name="Status" header_field=Impact


| appendpipe [
| table Region Service Resources
| eval Region=0
| eval Service=0 |eval Resources=0


| stats last(Region) AS Region , last(Service) as Service
| fillnull value="0" Region Service Resources

]
| eval OverallHealth = case(Critical>0,"CRITICAL",Warning>0,"WARNING",Warning=0 AND Critical=0,"HEALTHY") | Table Status,OverallHealth,Warning,Critical 

 

 

the result is as follows at the moment ,

Learnersplunk21_0-1624280956109.jpeg

 

Labels (3)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...