<?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: Create event if no results are returned in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/588618#M205008</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243098"&gt;@Gian89&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the most important thingi is that you solved your need.&lt;/P&gt;&lt;P&gt;We created an italian Splunk User Group, we didn't still have any event but we're organizing.&lt;/P&gt;&lt;P&gt;See next time.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the Contributors.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2022 09:54:54 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-03-11T09:54:54Z</dc:date>
    <item>
      <title>How to create event if no results are returned?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/587842#M204725</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;
&lt;P&gt;I have quite a strange issue to face...&lt;BR /&gt;For a project I'm working on, I would need to create a new case if the search returns no events.&lt;BR /&gt;I've tried to create a dummy example to make myself clear:&lt;/P&gt;
&lt;PRE&gt;| makeresults &lt;BR /&gt;| eval letter1="A", letter2="B", letter3="C" &lt;BR /&gt;| append &lt;BR /&gt;&amp;nbsp; &amp;nbsp; [| makeresults &lt;BR /&gt;&amp;nbsp; &amp;nbsp; | eval letter1="D", letter2="E", letter3="F"] &lt;BR /&gt;| search letter1="K"&lt;BR /&gt;| appendpipe &lt;BR /&gt;&amp;nbsp; &amp;nbsp; [| &lt;STRONG&gt;??ifnotresults??&lt;/STRONG&gt; &lt;BR /&gt;&amp;nbsp; &amp;nbsp; | append &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [| makeresults &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | eval letter1="X", letter2="Y", letter3="Z"] &lt;BR /&gt;&amp;nbsp; &amp;nbsp; | where false() ] &lt;BR /&gt;| table letter1 letter2 letter3&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In particular, I have no idea how to evaluate the&amp;nbsp;&lt;STRONG&gt;??ifnotresults??&lt;/STRONG&gt;&amp;nbsp; part.&lt;/P&gt;
&lt;P&gt;Do you think it is possible to achieve this?&lt;/P&gt;
&lt;P&gt;Thanks in advance for your kind support&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 04:50:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/587842#M204725</guid>
      <dc:creator>Gian89</dc:creator>
      <dc:date>2022-03-08T04:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create event if no results are returned</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/587849#M204729</link>
      <description>&lt;P&gt;i&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243098"&gt;@Gian89&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;you have many events from e.g. a list of hosts and you want to have a message when there isn't any result e.g. from one of those hosts, is it correct?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If this is your situation, you have three choices:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;if you have only one check to perform (e.g. only one host),&lt;/LI&gt;&lt;LI&gt;if you have few checks to perform (e.g. few hosts to check),&lt;/LI&gt;&lt;LI&gt;if you have many ckecks to perform (e.g. many hosts to check).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;in the first case you have to run a simple search and generate an alert if there isn't any result&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults index=_internal host=your_host&lt;/LI-CODE&gt;&lt;P&gt;in the second case, you have to run a simple search like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch index=_internal hostIN (host1, host2,host3)
| stats count BY host
| append [ | makeresults | eval host=host1, count=0 | fields host count ]
| append [ | makeresults | eval host=host2, count=0 | fields host count ]
| append [ | makeresults | eval host=host3, count=0 | fields host count ]
| stats sum(count) AS total BY host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;In the third case, you have to creat e a lookup (called e.g. perimeter.csv) containing the list of objects to search (e.g. host) and run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch index=_internal hostIN (host1, host2,host3)
| eval host=lower(host)
| stats count BY host
| append [ | inputlookup perimeter.csv | eval host=lower(host), count=0 | fields host count ]
| stats sum(count) AS total BY host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 13:05:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/587849#M204729</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-03-07T13:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create event if no results are returned</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/587853#M204732</link>
      <description>&lt;P&gt;Test for results using &lt;FONT face="courier new,courier"&gt;stats count&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;where count=0&lt;/FONT&gt; within the &lt;FONT face="courier new,courier"&gt;appendpipe&lt;/FONT&gt;.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval letter1="A", letter2="B", letter3="C" 
| append 
    [| makeresults 
    | eval letter1="D", letter2="E", letter3="F"] 
| search letter1="K"
| appendpipe 
    [ stats count
    | eval letter1="X", letter2="Y", letter3="Z"
    | where count=0
    | fields - count ] 
| table letter1 letter2 letter3&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 13:19:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/587853#M204732</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-03-07T13:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create event if no results are returned</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/588604#M205007</link>
      <description>&lt;P&gt;Ciao Giuseppe,&lt;/P&gt;&lt;P&gt;thanks for your answer but it was not what I was looking for. The answer from&amp;nbsp;&lt;SPAN&gt;richgalloway is what I was looking for &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks anyway for your feedback!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 09:36:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/588604#M205007</guid>
      <dc:creator>Gian89</dc:creator>
      <dc:date>2022-03-11T09:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create event if no results are returned</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/588618#M205008</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243098"&gt;@Gian89&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the most important thingi is that you solved your need.&lt;/P&gt;&lt;P&gt;We created an italian Splunk User Group, we didn't still have any event but we're organizing.&lt;/P&gt;&lt;P&gt;See next time.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the Contributors.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 09:54:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-event-if-no-results-are-returned/m-p/588618#M205008</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-03-11T09:54:54Z</dc:date>
    </item>
  </channel>
</rss>

