<?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 create an alert to trigger if the value stored in a CSV file increases by 5? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-to-trigger-if-the-value-stored-in-a-CSV/m-p/130020#M35380</link>
    <description>&lt;P&gt;Saved search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=*    | timechart last(Cnt) as CurrentQueueLength span=5m | Where CurrentQueueLength&amp;gt;0 | table CurrentQueueLength | outputcsv ABC 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;CSV:&lt;BR /&gt;
CurrentQueueLength&lt;BR /&gt;
15&lt;/P&gt;

&lt;P&gt;If the value increases by 5 (Value to be taken from CSV file), I need to trigger an alert ( cond=CurrentQueueLength+5).&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jul 2015 10:48:59 GMT</pubDate>
    <dc:creator>manja054</dc:creator>
    <dc:date>2015-07-20T10:48:59Z</dc:date>
    <item>
      <title>How to create an alert to trigger if the value stored in a CSV file increases by 5?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-to-trigger-if-the-value-stored-in-a-CSV/m-p/130020#M35380</link>
      <description>&lt;P&gt;Saved search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=*    | timechart last(Cnt) as CurrentQueueLength span=5m | Where CurrentQueueLength&amp;gt;0 | table CurrentQueueLength | outputcsv ABC 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;CSV:&lt;BR /&gt;
CurrentQueueLength&lt;BR /&gt;
15&lt;/P&gt;

&lt;P&gt;If the value increases by 5 (Value to be taken from CSV file), I need to trigger an alert ( cond=CurrentQueueLength+5).&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2015 10:48:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-to-trigger-if-the-value-stored-in-a-CSV/m-p/130020#M35380</guid>
      <dc:creator>manja054</dc:creator>
      <dc:date>2015-07-20T10:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert to trigger if the value stored in a CSV file increases by 5?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-to-trigger-if-the-value-stored-in-a-CSV/m-p/130021#M35381</link>
      <description>&lt;P&gt;I don't get your search: it could return more than 1 value or no values!  You should probably do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-5m@m sourcetype=* | stats latest(Cnt) as CurrentQueueLength | outputcsv ABC
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then schedule the following search as an alert that triggers when "# events &amp;gt; 0" and runs 1 minute before the first one runs (just before the value is overwritten):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-5m@m sourcetype=* | stats latest(Cnt) as CurrentQueueLength | append [|inputcsv ABC | rename CurrentQueueLength AS PrevQueueLength] | eval delta = CurrentQueueLength - PrevQueueLength | where delta &amp;gt; 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, you might consider using &lt;CODE&gt;avg&lt;/CODE&gt; but definitely don't use &lt;CODE&gt;last&lt;/CODE&gt; because it does the opposite of what you think it does (earliest value), which is why I switched it to &lt;CODE&gt;latest&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2015 14:18:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-to-trigger-if-the-value-stored-in-a-CSV/m-p/130021#M35381</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-20T14:18:09Z</dc:date>
    </item>
  </channel>
</rss>

