<?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 How to trigger an action when no results are found (without using the settings in a saved alert) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369038#M108762</link>
    <description>&lt;P&gt;My organization using something called Ticketer to in Splunk to auto-generate an incident form when something shows up in the logs. An example would look like this:&lt;/P&gt;

&lt;P&gt;ns="my_application_namespace" "Exception X has occurred" | eval severity="4" | eval emailAddress="&lt;A href="mailto:myTeam@somewhere.com" target="_blank"&gt;myTeam@somewhere.com&lt;/A&gt;" | eval description = "Exception X has occured" | ticketer&lt;/P&gt;

&lt;P&gt;I saved that alert and it runs once an hour and if "Exception X has occurred" shows up in the logs anywhere an incident is created. Note that this isn't configured in the saved alert, it is part of the search query. &lt;/P&gt;

&lt;P&gt;Now, what want to do is run a search query for a healthcheck url to make sure a service is up and running. If I don't see the healthcheck url appearing in the logs for an hour it means the service is down and an incident needs to be created. &lt;/P&gt;

&lt;P&gt;This is what I have so far: &lt;BR /&gt;
ns="my_application_namespace" "healthcheckUrlHere" | eval severity="4" | eval emailAddress="&lt;A href="mailto:myTeam@somewhere.com" target="_blank"&gt;myTeam@somewhere.com&lt;/A&gt;" | eval description = "The Servive is down" | ticketer&lt;/P&gt;

&lt;P&gt;I'm thinking I could use something like | stats count | search count=0&lt;/P&gt;

&lt;P&gt;Would this work if I inserted it before the eval portion of the search? Like: ns="my_application_namespace" "healthcheckUrlHere" | stats count | search count=0 | eval severity="4" | eval emailAddress="&lt;A href="mailto:myTeam@somewhere.com" target="_blank"&gt;myTeam@somewhere.com&lt;/A&gt;" | eval description = "The Servive is down" | ticketer&lt;/P&gt;

&lt;P&gt;Or is there a better way of doing something like this that I don't know about? &lt;/P&gt;

&lt;P&gt;Thanks for any help! &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 16:46:55 GMT</pubDate>
    <dc:creator>lordhans</dc:creator>
    <dc:date>2020-09-29T16:46:55Z</dc:date>
    <item>
      <title>How to trigger an action when no results are found (without using the settings in a saved alert)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369038#M108762</link>
      <description>&lt;P&gt;My organization using something called Ticketer to in Splunk to auto-generate an incident form when something shows up in the logs. An example would look like this:&lt;/P&gt;

&lt;P&gt;ns="my_application_namespace" "Exception X has occurred" | eval severity="4" | eval emailAddress="&lt;A href="mailto:myTeam@somewhere.com" target="_blank"&gt;myTeam@somewhere.com&lt;/A&gt;" | eval description = "Exception X has occured" | ticketer&lt;/P&gt;

&lt;P&gt;I saved that alert and it runs once an hour and if "Exception X has occurred" shows up in the logs anywhere an incident is created. Note that this isn't configured in the saved alert, it is part of the search query. &lt;/P&gt;

&lt;P&gt;Now, what want to do is run a search query for a healthcheck url to make sure a service is up and running. If I don't see the healthcheck url appearing in the logs for an hour it means the service is down and an incident needs to be created. &lt;/P&gt;

&lt;P&gt;This is what I have so far: &lt;BR /&gt;
ns="my_application_namespace" "healthcheckUrlHere" | eval severity="4" | eval emailAddress="&lt;A href="mailto:myTeam@somewhere.com" target="_blank"&gt;myTeam@somewhere.com&lt;/A&gt;" | eval description = "The Servive is down" | ticketer&lt;/P&gt;

&lt;P&gt;I'm thinking I could use something like | stats count | search count=0&lt;/P&gt;

&lt;P&gt;Would this work if I inserted it before the eval portion of the search? Like: ns="my_application_namespace" "healthcheckUrlHere" | stats count | search count=0 | eval severity="4" | eval emailAddress="&lt;A href="mailto:myTeam@somewhere.com" target="_blank"&gt;myTeam@somewhere.com&lt;/A&gt;" | eval description = "The Servive is down" | ticketer&lt;/P&gt;

&lt;P&gt;Or is there a better way of doing something like this that I don't know about? &lt;/P&gt;

&lt;P&gt;Thanks for any help! &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:46:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369038#M108762</guid>
      <dc:creator>lordhans</dc:creator>
      <dc:date>2020-09-29T16:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an action when no results are found (without using the settings in a saved alert)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369039#M108763</link>
      <description>&lt;P&gt;If you're only looking for a single healthCheckUrl this is likely pretty simple, and what you have above should be fine.&lt;/P&gt;

&lt;P&gt;If you wanted to abstract it out to multiple &lt;CODE&gt;ns&lt;/CODE&gt; or &lt;CODE&gt;healthCheckUrl&lt;/CODE&gt; values it would be more involved.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 00:57:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369039#M108763</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-11-14T00:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an action when no results are found (without using the settings in a saved alert)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369040#M108764</link>
      <description>&lt;P&gt;Your query looks good.  You can combine different eval statement in single command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ns="my_application_namespace" "healthcheckUrlHere" | stats count | search count=0 | eval severity="4", emailAddress="myTeam@somewhere.com" , description = "The Servive is down" | ticketer
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Nov 2017 05:37:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369040#M108764</guid>
      <dc:creator>hardikJsheth</dc:creator>
      <dc:date>2017-11-14T05:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an action when no results are found (without using the settings in a saved alert)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369041#M108765</link>
      <description>&lt;P&gt;Hi lordhans,&lt;BR /&gt;
knowing the list of processes to healthcheck I'd think to a different approach creating a lookup containing the processes to check:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your_search [ | inputlookup processes.csv | fields process ]
| eval process=lower(process)
| stats count by process
| append [ | inputlookup processes.csv | eval process=lower(process), count=0 | fields process count ]
| stats sum(count) AS Total BY process
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this way, processes where Total=0 are missed and processes where Total&amp;gt;0 are OK.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 07:58:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-action-when-no-results-are-found-without-using/m-p/369041#M108765</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-11-14T07:58:13Z</dc:date>
    </item>
  </channel>
</rss>

