Dashboards & Visualizations

Zeroes instead of "no result found"

petreb
Path Finder

Hello,

I have the search below which should graph the count of the error messages grouped by criticality; the visualisation is "single value" with trellis split by criticality.

it all works as long as there are values found. when there are no events found for one criticality value, the trellis graph not displayed; when events for both criticality values aren't found, the "no results found" message is displayed.

I'm looking for a way to simulate the fillnull function in the case of missing events; I have tried the solutions with makeresults and appendpipe (as described here, here and here), but none worked for me.

The goal is to have zeroes for each time period automatially calculated by timechart where the events are missing. I guess the count column cannot be initialised somehow, as long as there is no value for the selected time period (the "search criticality = ...." subsearch)

 

cheers

 

 

index=<index> source=<source> 
| rex ".\d{3}Z\s(app|batchrun\s-\s\w+)\s(?<loglevel>1|2|3|4|5)\s"
| eval criticality=case(loglevel == "1", "error", loglevel == "2", "warning", loglevel == "3", "info", loglevel == "4", "debug")
| search criticality = error OR criticality = info OR criticality = warning
| timechart count by criticality

 

 

 

Labels (4)
0 Karma

thambisetty
SplunkTrust
SplunkTrust

Since you have fixed values for criticality and I assume, your search returns only one row of results not more than one row at any point of time.

| append 
    [| makeresults 
    | fields - _time 
    | eval error="0",info="0",warning="0"] 
| stats values(*) as *
| foreach * [eval  <<FIELD>> = if(isnull(mvindex(<<FIELD>>,1)),mvindex(<<FIELD>>,0),mvindex(<<FIELD>>,1))]
————————————
If this helps, give a like below.
0 Karma

petreb
Path Finder

as you said, it works for a single row; however, I am interested to make it work over the whole timeframe where the count() applied; what I want to achieve is to have two more columns (warning + error) in the table below - is it possible?

 _timeinfo
12020-09-22 14:00:0066
22020-09-22 14:30:0056
32020-09-22 15:00:0064
42020-09-22 15:30:0056
52020-09-22 16:00:0066
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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