<?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: Using the 'where' clause as a Custom Alert Trigger condition? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222337#M65380</link>
    <description>&lt;P&gt;If Today and Yesterday are numbers, then just try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="transactionLog" type="report" earliest=-1d@d latest=now 
 | eval Day=if(_time&amp;gt;=relative_time(now(),"@d"),"Today","Yesterday") 
 | chart avg(responsetime) over product by Day
 | where Today&amp;gt;2*Yesterday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Jan 2017 04:13:52 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2017-01-09T04:13:52Z</dc:date>
    <item>
      <title>Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222329#M65372</link>
      <description>&lt;P&gt;I am attempting to set up an Alert which will trigger when average response times for various products over the week have increased by at least double in comparison to the previous week. &lt;/P&gt;

&lt;P&gt;However it is not working out exactly as I had in mind.&lt;/P&gt;

&lt;P&gt;My search query for the alert is as follows;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="transactionLog" type="report" earliest=-1d@d latest=now 
| eval Day=if(_time&amp;gt;=relative_time(now(),"@d"),"Today","Yesterday") 
| chart avg(responsetime) over product by Day
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And then I am using a custom trigger condition as follows;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search where Today&amp;gt;2*Yesterday 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However the problem is, whether I add the where clause to the end of my search or not, there are still over 700,000 events returned as results - so my alert notification returns all response times for ALL products (even the ones which did not see an increase).&lt;/P&gt;

&lt;P&gt;ie; whether I include the where clause at the end of my search or not, there is still the same number of returned events?&lt;/P&gt;

&lt;P&gt;This means the alert notification contains a whole lot of irrelevant data - I would ideally like to see ONLY the instances in the alert notification where the average response time has doubled, not all of the data.&lt;/P&gt;

&lt;P&gt;I assume the WHERE clause does not actually filter out results which do not match the clause?&lt;/P&gt;

&lt;P&gt;Is there a more suitable way to approach this?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 00:50:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222329#M65372</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2017-01-09T00:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222330#M65373</link>
      <description>&lt;P&gt;Hello Alexander,&lt;BR /&gt;
It looks like, Splunk sends out the result of search if one of the result matches your condition in where clause. Ie, if one of the rows has a value  Today&amp;gt;2*Yesterday, then it sends out the whole result of the search.&lt;/P&gt;

&lt;P&gt;Try adding your condition ( where Today&amp;gt;2*Yesterday) to the main search itself  and change the alert condition to &lt;CODE&gt;if number of events is greater than 0&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 03:05:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222330#M65373</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2017-01-09T03:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222331#M65374</link>
      <description>&lt;P&gt;@renjith.nair&lt;/P&gt;

&lt;P&gt;Thank you for your response.&lt;/P&gt;

&lt;P&gt;I am curious why anyone would choose to use the &lt;STRONG&gt;where&lt;/STRONG&gt; clause if the entire result list is returned by the search query, rather than including the condition in the main search query as you suggested?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 03:14:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222331#M65374</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2017-01-09T03:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222332#M65375</link>
      <description>&lt;P&gt;@renjith.nair&lt;/P&gt;

&lt;P&gt;I have tested this and it still does not seem to work - as you can see, the Today and Yesterday are referencing time periods - so when I attempt to add this to the end of my search, it still yields all of the 700,000+ results;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="transactionLog" type="report" earliest=-1d@d latest=now 
| eval Day=if(_time&amp;gt;=relative_time(now(),"@d"),"Today","Yesterday") 
| chart avg(responsetime) over product by Day
| search where Today&amp;gt;2*Yesterday 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The last line above is the new line.&lt;/P&gt;

&lt;P&gt;Perhaps the fault lies in the logic within my search query..&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 03:23:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222332#M65375</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2017-01-09T03:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222333#M65376</link>
      <description>&lt;P&gt;The last line should be &lt;CODE&gt;| where Today&amp;gt;2*Yesterday&lt;/CODE&gt; . Then the main/alert search would only return the rows which are satisfying the where clause.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 03:29:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222333#M65376</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-09T03:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222334#M65377</link>
      <description>&lt;P&gt;Please have a look at the following link for better understanding : &lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.1/Alert/AlertTriggerConditions#How_searches_and_trigger_conditions_work_together"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.1/Alert/AlertTriggerConditions#How_searches_and_trigger_conditions_work_together&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So the condition can be used when you want all the results but only if some condition matches. &lt;/P&gt;

&lt;P&gt;And in your original search , just add &lt;CODE&gt;where Today&amp;gt;2*Yesterday&lt;/CODE&gt; without search &lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 03:32:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222334#M65377</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2017-01-09T03:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222335#M65378</link>
      <description>&lt;P&gt;@somesoni2&lt;/P&gt;

&lt;P&gt;This is how I had it set up initially as you had previously suggested on a different Answer.&lt;/P&gt;

&lt;P&gt;The problem is that this does not work.&lt;/P&gt;

&lt;P&gt;Whether I have that &lt;STRONG&gt;where&lt;/STRONG&gt; clause on the end of the search or not, I still receive the same number of results (700,000+) including all results which do not fit the clause requirements..?&lt;/P&gt;

&lt;P&gt;Hence why I have posted this question..&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 03:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222335#M65378</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2017-01-09T03:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222336#M65379</link>
      <description>&lt;P&gt;@renjith.nair&lt;BR /&gt;
@somesoni2&lt;/P&gt;

&lt;P&gt;My mistake - I made a typo in the previous comment - my actual search query is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="transactionLog" type="report" earliest=-1d@d latest=now 
| eval Day=if(_time&amp;gt;=relative_time(now(),"@d"),"Today","Yesterday") 
| chart avg(responsetime) over product by Day
| search Today&amp;gt;2*Yesterday 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jan 2017 03:55:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222336#M65379</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2017-01-09T03:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222337#M65380</link>
      <description>&lt;P&gt;If Today and Yesterday are numbers, then just try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="transactionLog" type="report" earliest=-1d@d latest=now 
 | eval Day=if(_time&amp;gt;=relative_time(now(),"@d"),"Today","Yesterday") 
 | chart avg(responsetime) over product by Day
 | where Today&amp;gt;2*Yesterday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jan 2017 04:13:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222337#M65380</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2017-01-09T04:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222338#M65381</link>
      <description>&lt;P&gt;@renjith.nair&lt;BR /&gt;
Today and Yesterday are not numbers - they are time related as you can see from the above search?&lt;/P&gt;

&lt;P&gt;@somesoni2 advised that they are however related to the responsetime due to the chart function.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 04:15:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222338#M65381</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2017-01-09T04:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222339#M65382</link>
      <description>&lt;P&gt;As per your search , they are just avg of responsetime splitted across today and yesterday. So the values under Today and Yesterday should be some avgs. can you confirm that or just paste some sample values ? If you are doing an arithmatic like 2*Yesterday, then it should be some numbers&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 04:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222339#M65382</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2017-01-09T04:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222340#M65383</link>
      <description>&lt;P&gt;When you say you're getting 700,000+ results, where are you checking this? What is the number of rows that you get in the "Statistics" tab when you run the search manually?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 04:30:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222340#M65383</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-09T04:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222341#M65384</link>
      <description>&lt;P&gt;@somesoni2&lt;/P&gt;

&lt;P&gt;Below the search input box:&lt;/P&gt;

&lt;P&gt;** 697,139 events (1/1/17 12:00:00.000 AM to 1/9/17 2:19:19.000 PM)**&lt;/P&gt;

&lt;P&gt;In the statistics tab there is just one result.&lt;/P&gt;

&lt;P&gt;However the events tab has all of the events.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 04:34:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222341#M65384</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2017-01-09T04:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222342#M65385</link>
      <description>&lt;P&gt;Which tab of data will trigger an alert??&lt;/P&gt;

&lt;P&gt;The alert emails me back with all products and their response times for each day - regardless of whether they have had a 2x increase since yesterday @somesoni2&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 04:36:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222342#M65385</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2017-01-09T04:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222343#M65386</link>
      <description>&lt;P&gt;If you're running the search in the "Verbose Mode" (little dropdown below the search magnifying glass button), it shows all the events which were used to generate the summary, i.e. result of the base search. The number of records in the Statistics is the actual number of results returned by your full search.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 04:36:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222343#M65386</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-09T04:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using the 'where' clause as a Custom Alert Trigger condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222344#M65387</link>
      <description>&lt;P&gt;This analogous search work for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_* earliest=-1d@d latest=now 
| eval Day=if(_time&amp;gt;=relative_time(now(),"@d"),"Today","Yesterday") 
| chart count over sourcetype by Day
| where Today&amp;lt;(2*Yesterday)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jan 2017 14:59:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-the-where-clause-as-a-Custom-Alert-Trigger-condition/m-p/222344#M65387</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-01-09T14:59:08Z</dc:date>
    </item>
  </channel>
</rss>

