<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Display a  custom text when results=0 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692092#M235599</link>
    <description>&lt;P&gt;Please share your full search so we might be able to determine why you are not getting any results.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 13:03:00 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-07-01T13:03:00Z</dc:date>
    <item>
      <title>Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692070#M235593</link>
      <description>&lt;P&gt;How do I run a search against a sourcetype (which is very low volume), and display a custom text when there are 0 events found.&amp;nbsp; Search should be run for 30days, with a span of 1day.&lt;/P&gt;&lt;P&gt;Output should be -&lt;/P&gt;&lt;P&gt;_time results&lt;/P&gt;&lt;P&gt;04-23-2024 "No events found"&lt;/P&gt;&lt;P&gt;04-23-2024 "No events found"&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;06-30-2024 23&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 11:19:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692070#M235593</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-07-01T11:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692074#M235595</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval results=if(results=0,"No events Found",results)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Jul 2024 11:25:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692074#M235595</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-01T11:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692088#M235597</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;Thank you for your response.&amp;nbsp; But it did not work.&amp;nbsp; I don't get any results.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 12:59:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692088#M235597</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-07-01T12:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692090#M235598</link>
      <description>&lt;P&gt;If you're using the timechart command, it generates zero count for periods when there is no values. Otherwise you need to use this approach &lt;A href="https://www.duanewaddle.com/proving-a-negative/" target="_blank"&gt;https://www.duanewaddle.com/proving-a-negative/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 13:00:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692090#M235598</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-07-01T13:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692092#M235599</link>
      <description>&lt;P&gt;Please share your full search so we might be able to determine why you are not getting any results.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 13:03:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692092#M235599</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-01T13:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692134#M235612</link>
      <description>&lt;P&gt;So I have a data source which is very low volume and is not expected to have events at all (like only if there is an unexpected event, it logs that).&amp;nbsp; I have a requirement to produce a report showing there were no unexpected events in last 90days. I tried following search query but it is not giving the results per day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=foo  | timechart span=1d count as event_count by sourcetype | append [|stats count as event_count | eval text="no events found"]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS - the count you are seeing below is for the other sourceytpe that is under the same index=foo, and the sourcetype where the count is 0 is displayed at the bottom ( sourcetype name is not displayed as there are no events for that sourcetype).&lt;/P&gt;
&lt;P&gt;I want my output to be specific to this sourcetype and display count = 0 for all the days where the data is not present.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Richy_s_0-1719849569962.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31584i42D8FEC6C33754DF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Richy_s_0-1719849569962.png" alt="Richy_s_0-1719849569962.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 16:03:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692134#M235612</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-07-01T16:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692140#M235615</link>
      <description>&lt;P&gt;If you know all the sourcetypes you are interested in (A, B, C, D, E, F in my example), you could do something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=1d count as event_count by sourcetype usenull=f
| foreach A B C D E F
    [| eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=coalesce(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;,0)
    | eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;==0,"No events found",&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;)]&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Jul 2024 16:39:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692140#M235615</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-01T16:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692157#M235622</link>
      <description>&lt;P&gt;Another example here:&lt;BR /&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-if-there-is-no-result-from-the-base-search-and/m-p/172604/highlight/true#M49484" target="_blank"&gt;Solved: Re: How to use eval if there is no result from the... - Splunk Community&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 00:00:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692157#M235622</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2024-07-02T00:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692299#M235646</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;.&amp;nbsp; This seems to be working however it is not displaying the "No events found" where there are 0 or blank events. Attached snapshot below.&amp;nbsp; Also, can you please explain the query.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Richy_s_0-1720010416938.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31602i6B1497AD83FEF811/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Richy_s_0-1720010416938.png" alt="Richy_s_0-1720010416938.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 12:41:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692299#M235646</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-07-03T12:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692339#M235654</link>
      <description>&lt;P&gt;Try putting the &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; on the right-hand side of the assignment in single quotes (since you have chosen to hide your sourcetypes, it could be that they have special characters in which the single quotes will deal with)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=1d count as event_count by sourcetype usenull=f
| foreach A B C D E F
    [| eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=coalesce('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',0)
    | eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'==0,"No events found",'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 03 Jul 2024 17:23:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692339#M235654</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-03T17:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692397#M235668</link>
      <description>&lt;P&gt;That worked, one last thing, how do I display only specific sourcetype out of (A B C D E) for where event for each day?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 10:38:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692397#M235668</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-07-04T10:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692400#M235671</link>
      <description>&lt;P&gt;Not sure I understand the requirement - do you want to remove the sourcetypes which have events every day? Please clarify&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 10:43:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692400#M235671</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-04T10:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692421#M235684</link>
      <description>&lt;P&gt;&lt;SPAN&gt;That worked!! One last thing, how do I display only specific sourcetype out of (A B C D E) for where the events for all the days=0. reword this statement&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 16:16:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692421#M235684</guid>
      <dc:creator>Richy_s</dc:creator>
      <dc:date>2024-07-04T16:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Display a  custom text when results=0</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692422#M235685</link>
      <description>&lt;P&gt;There are a number of ways to do this - to find which sourcetypes have zero events, create an event for each sourcetype with a zero count and add it to the count for the sourcetype, and where the count is still zero, there were no events for that sourcetype.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count by sourcetype
| append
    [| makeresults format=csv data="sourcetype,count
A,0
B,0
C,0
D,0
E,0
F,0"
    | table sourcetype count]
| stats sum(count) as count by sourcetype
| where count=0
| eval count="No events found"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Jul 2024 16:51:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-a-custom-text-when-results-0/m-p/692422#M235685</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-04T16:51:11Z</dc:date>
    </item>
  </channel>
</rss>

