Splunk Enterprise

help for displaying a text in a chart panel if no results

jip31
Motivator

hello

 

 

`weatherevent` 
| fields host EventCode 

| eval time = strftime(_time, "%m/%d/%Y %H:%M") 
| search host=tutu
| eval EventCode=case(EventCode==41, "System reboot without cleanly shutting down first", EventCode==10111, "Device offline due to a user-mode driver crash", EventCode==10110, "Problem  with ouser-mode drivers") 
| stats count as ID by EventCode 
| eval ID=if(isnull(ID),"No critical ID for this host",ID)

 

I need to display a message in a chart panel if there is no results

I have done it in a eval command but it doesn't works

could you help me please?? 

Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This is a classic case of trying to display something that doesn't exist in your data. The way around this is to add to your data to give splunk something to display. In your case, you need an eventcode for every host you are interested in that doesn't already have an eventcode or another way would be to add a default event code for every host, then overwrite it with the event code for that host from the data.

0 Karma

jip31
Motivator

it doesnt help me a lot...

something like this?

| stats count as ID by EventCode host
| eval ID=if(isnull(ID),"No critical ID for this host",ID)

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Not really. You are still trying to do something for a host that splunk doesn't have any data for. Which hosts do you want these messages for?

0 Karma

jip31
Motivator

I want this message for hosts that have no eventcode corresponding

it means hosts which have no ID 41, ID 10110 or 10111 events

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Which hosts are they? If there are no events for that host in your data, how does splunk know which hosts you are interested in?

0 Karma

jip31
Motivator

But I dont need to identify the hostname concerned...

I just need to display a message is there is no event with the related ID......

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You said earlier

| stats count as ID by EventCode host
| eval ID=if(isnull(ID),"No critical ID for this host",ID)

This mentions host. Are you now saying you aren't interested in the host?

0 Karma

jip31
Motivator

I use a input token in my dashboard

This input coorespond to the hostname I need to check

    <input type="text" token="tok_filterhost" searchWhenChanged="true">
      <label>Hostname</label>
      <default>*</default>
    </input>

 If there is not event ID for this host I need to display a message

`weatherevent` 
| fields host EventCode 
| search host=$tok_filterhost$
| eval time = strftime(_time, "%m/%d/%Y %H:%M") 
| eval EventCode=case(EventCode==41, "System reboot without cleanly shutting down first", EventCode==10111, "Device offline due to a user-mode driver crash", EventCode==10110, "Problem  with ouser-mode drivers") 
| stats count as ID by EventCode 
| eval ID=if(isnull(ID),"No critical ID for this host",ID)

  

0 Karma
Get Updates on the Splunk Community!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...