<?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: Alert (with a chart) when latest occurrences of some of the rows is over a certain time in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206859#M3650</link>
    <description>&lt;P&gt;Use the search you already have and save it as an alert using a custom search as the trigger.&lt;/P&gt;

&lt;P&gt;Click &lt;STRONG&gt;Save As&lt;/STRONG&gt;, then &lt;STRONG&gt;Alert&lt;/STRONG&gt;&lt;BR /&gt;
Name it and whatnot&lt;BR /&gt;
Set an &lt;STRONG&gt;Alert Type&lt;/STRONG&gt; of &lt;STRONG&gt;Scheduled&lt;/STRONG&gt;&lt;BR /&gt;
Change the schedule drop-down to &lt;STRONG&gt;Run on Cron schedule&lt;/STRONG&gt;&lt;BR /&gt;
You can set your earliest &lt;CODE&gt;-4h&lt;/CODE&gt; here if you want, or  just leave it in your search&lt;BR /&gt;
For your &lt;STRONG&gt;Cron Expression&lt;/STRONG&gt; put in &lt;CODE&gt;*/15 * * * *&lt;/CODE&gt; to run it every 15 minutes, or &lt;CODE&gt;*/5 * * * *&lt;/CODE&gt; for every 5.&lt;BR /&gt;
In &lt;STRONG&gt;Trigger Conditions&lt;/STRONG&gt;, select &lt;STRONG&gt;Trigger alert when&lt;/STRONG&gt; option of type &lt;STRONG&gt;Custom&lt;/STRONG&gt;&lt;BR /&gt;
For the custom search, use &lt;CODE&gt;search "Minutes since last heartbeat" &amp;gt; 30&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You may want to throttle it, maybe not - just depends on your time frame and how often it runs.&lt;BR /&gt;
Then set whatever alert action you want to use for testing and see what happens in a few minutes.&lt;/P&gt;

&lt;P&gt;Did I mention to do a little testing before you shoot some unsuspecting coworker a zillion emails because you fat fingered something?  If I didn't, consider it mentioned now.  Lessons learned the hard way...  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;A link to &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/Alert/Definescheduledalerts#Using_cron_expressions"&gt;cron expressions in Splunk&lt;/A&gt;, and another on &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/Alert/AlertTriggerConditions"&gt;Alert trigger configuration&lt;/A&gt;.  Other items in the menus on that last link go to examples of alerts, too.&lt;/P&gt;

&lt;P&gt;If you'd like to test that and see what it does, you could append that same snippet to the end of your existing search, like so.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | search "Minutes since last heartbeat" &amp;gt; 30
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 11 Jun 2016 01:27:05 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2016-06-11T01:27:05Z</dc:date>
    <item>
      <title>Alert (with a chart) when latest occurrences of some of the rows is over a certain time</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206858#M3649</link>
      <description>&lt;P&gt;New Splunk user here. I've searched and seen a lot of questions and answers that were similar to mine, but none that were close enough to help me figure out what to do in my exact scenario.  So, here goes.&lt;/P&gt;

&lt;P&gt;I have a number of hosts that have a log file that contains a heartbeat entry that typically occurs every 2 minutes. I created a chart that shows a list of each of the server hostnames along with the time of the latest heartbeat log line and a calculated value of the time since that latest heartbeat was found. This is so you can easily see if it's way over 2 minutes and know you've got some kind of issue with this server.&lt;/P&gt;

&lt;P&gt;My challenge now is that I'd like to set up an alert for when the latest time of any server's heartbeat is greater than 30 minutes so a user can get an email with that nice chart embedded, can easily see which server is affected, and how long it's been since the last heartbeat.  I just can't figure out how I can do that with the data in chart form...  I know the solution is probably easy, it's just eluding me for some reason.&lt;/P&gt;

&lt;P&gt;Here's what my search currently looks like, with some index/sourcetypes removed since it's not relevant:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Sending heartbeat request" earliest=-4h | eval time_elapsed = round((now() - _time)/60,0) | stats latest(_time) AS "Latest Heartbeat", latest(time_elapsed) AS "Minutes since last heartbeat" by host | convert ctime("Latest Heartbeat")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And here's what my output looks like:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="Chart screenshot"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1466i6A3D72570AFD77D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Chart screenshot" alt="Chart screenshot" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I've tried things like added a WHERE clause, but it just doesn't seem to output in the way I need it to.  I'm hoping someone's got an easy solution. I'm sure there is one, and my noob-ness is just getting in the way.  Thanks!!!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2016 19:56:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206858#M3649</guid>
      <dc:creator>curtisk</dc:creator>
      <dc:date>2016-06-10T19:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Alert (with a chart) when latest occurrences of some of the rows is over a certain time</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206859#M3650</link>
      <description>&lt;P&gt;Use the search you already have and save it as an alert using a custom search as the trigger.&lt;/P&gt;

&lt;P&gt;Click &lt;STRONG&gt;Save As&lt;/STRONG&gt;, then &lt;STRONG&gt;Alert&lt;/STRONG&gt;&lt;BR /&gt;
Name it and whatnot&lt;BR /&gt;
Set an &lt;STRONG&gt;Alert Type&lt;/STRONG&gt; of &lt;STRONG&gt;Scheduled&lt;/STRONG&gt;&lt;BR /&gt;
Change the schedule drop-down to &lt;STRONG&gt;Run on Cron schedule&lt;/STRONG&gt;&lt;BR /&gt;
You can set your earliest &lt;CODE&gt;-4h&lt;/CODE&gt; here if you want, or  just leave it in your search&lt;BR /&gt;
For your &lt;STRONG&gt;Cron Expression&lt;/STRONG&gt; put in &lt;CODE&gt;*/15 * * * *&lt;/CODE&gt; to run it every 15 minutes, or &lt;CODE&gt;*/5 * * * *&lt;/CODE&gt; for every 5.&lt;BR /&gt;
In &lt;STRONG&gt;Trigger Conditions&lt;/STRONG&gt;, select &lt;STRONG&gt;Trigger alert when&lt;/STRONG&gt; option of type &lt;STRONG&gt;Custom&lt;/STRONG&gt;&lt;BR /&gt;
For the custom search, use &lt;CODE&gt;search "Minutes since last heartbeat" &amp;gt; 30&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You may want to throttle it, maybe not - just depends on your time frame and how often it runs.&lt;BR /&gt;
Then set whatever alert action you want to use for testing and see what happens in a few minutes.&lt;/P&gt;

&lt;P&gt;Did I mention to do a little testing before you shoot some unsuspecting coworker a zillion emails because you fat fingered something?  If I didn't, consider it mentioned now.  Lessons learned the hard way...  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;A link to &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/Alert/Definescheduledalerts#Using_cron_expressions"&gt;cron expressions in Splunk&lt;/A&gt;, and another on &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/Alert/AlertTriggerConditions"&gt;Alert trigger configuration&lt;/A&gt;.  Other items in the menus on that last link go to examples of alerts, too.&lt;/P&gt;

&lt;P&gt;If you'd like to test that and see what it does, you could append that same snippet to the end of your existing search, like so.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | search "Minutes since last heartbeat" &amp;gt; 30
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Jun 2016 01:27:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206859#M3650</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-06-11T01:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Alert (with a chart) when latest occurrences of some of the rows is over a certain time</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206860#M3651</link>
      <description>&lt;P&gt;Oh, and if you email it, be sure to click the &lt;STRONG&gt;Include&lt;/STRONG&gt; option of &lt;STRONG&gt;Inline Table&lt;/STRONG&gt; to include the pretty table of results in the email itself.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2016 01:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206860#M3651</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-06-11T01:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Alert (with a chart) when latest occurrences of some of the rows is over a certain time</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206861#M3652</link>
      <description>&lt;P&gt;BRILLIANT.  I didn't realize you could do a secondary search of the results of the table like that!  Mind blown.  Thanks!!!  And yes, I'm testing out sending the email alerts only to myself for now.  &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 15:12:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-with-a-chart-when-latest-occurrences-of-some-of-the-rows/m-p/206861#M3652</guid>
      <dc:creator>curtisk</dc:creator>
      <dc:date>2016-06-13T15:12:38Z</dc:date>
    </item>
  </channel>
</rss>

