Splunk Search

How to replace message "no result found" resulting to outputlookup

mah
Builder

Hi, 

I have to display on a dashboard the content of a lookup which is some time empty and so shows the message "no result found". 

My query is : 

index=A sourcetype="B" id=*
| table id name | outputlookup example.csv

How can I modify this message ? 

Labels (1)
Tags (1)
0 Karma

to4kawa
Ultra Champion

sample:

index=_internal sourcetype=splunk
| appendpipe 
    [| stats count 
    | eval msg="No event for this host" | where count=0 |table msg ]

There is only msg field.

<condition match="'result.msg' ==&quot;No event for this host&quot;">
    <set token="tables">msg</set> </condition>
<condition>
     <set token="tables">id,name,&quot;Start time&quot;,&quot;End time&quot;</set>
</condition>

Now, why don't you try using the token value as the | table argument?

 

0 Karma

mah
Builder

Sorry, I never set a condition ... So I try to understand : 

Here is my xml code with your solution : 

 

 

 

<table>
        <search>
          <query>index=A sourcetype="B" id=*
| table id name start end 
| sort - start
| appendpipe 
    [| stats count 
    | eval msg="No event for this table" | where count=0 |table $tables$ ]</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
          <finalized>
            <condition match="'result.msg' ==&quot;No event for this table&quot;">
            <set token="tables">msg</set> </condition>
            <condition>
            <set token="tables">id,name,start,end</set>
            </condition>
          </finalized>
          </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="refresh.display">progressbar</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>

 

 

 

But it is not working : still have the message "no results found"

0 Karma

mah
Builder

hi @to4kawa 

I saw this answer before I asked this question. The thing is that it gives me a table like that :

mah_0-1608798059157.png

And what I want if it is possible is just the message and not other empty cells. 

Is it possible ?

Tags (1)
0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...