<?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 Alert Query in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438221#M7640</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have to search the string below&lt;BR /&gt;
Error Code : 5010 | Barcodes {X} &lt;BR /&gt;
X is some value, and it can be change frequently, I need to raise an alert when one barcode is repeating twice and not raising the alert for same barcode throughout a day.&lt;BR /&gt;
What should be my search, and how can I display for which barcode I have raised the alert.&lt;BR /&gt;
Thanks in Advance&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jan 2019 09:00:39 GMT</pubDate>
    <dc:creator>FayazAhmed</dc:creator>
    <dc:date>2019-01-31T09:00:39Z</dc:date>
    <item>
      <title>Alert Query</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438221#M7640</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have to search the string below&lt;BR /&gt;
Error Code : 5010 | Barcodes {X} &lt;BR /&gt;
X is some value, and it can be change frequently, I need to raise an alert when one barcode is repeating twice and not raising the alert for same barcode throughout a day.&lt;BR /&gt;
What should be my search, and how can I display for which barcode I have raised the alert.&lt;BR /&gt;
Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 09:00:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438221#M7640</guid>
      <dc:creator>FayazAhmed</dc:creator>
      <dc:date>2019-01-31T09:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Alert Query</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438222#M7641</link>
      <description>&lt;P&gt;Given you have not extracted your fields yet you could try it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;base search&amp;gt; | rex field=_raw "Error\sCode\s:\s(?&amp;lt;error_code&amp;gt;[\d]+)\s\|\sBarcodes\s\{(?&amp;lt;barcodes&amp;gt;[^\}]+)" | where error_code=5010 | stats count by barcodes | where count &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Save the search as an alert and set the trigger condition to number of results greater than 0, and alert for each result, activate throtteling and set the throttle period to 1 day.&lt;/P&gt;

&lt;P&gt;Then you may add any desired alert action.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 13:07:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438222#M7641</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2019-01-31T13:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Alert Query</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438223#M7642</link>
      <description>&lt;P&gt;@FayazAhmed &lt;/P&gt;

&lt;P&gt;I think you query should be like below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index "Error Code : 5010" Barcodes=* | stats count by Barcodes  |where count=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;P&gt;if your events have &lt;CODE&gt;Error_Code&lt;/CODE&gt; field then&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index Error_Code=5010 Barcodes=* | stats count by Barcodes  |where count=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Create an alert using any of above search. Use below link to create search.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/Alert/Alertexamples"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/Alert/Alertexamples&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;for &lt;STRONG&gt;not raising the alert for same barcode throughout a day&lt;/STRONG&gt;, you have to set Throttle with field=&lt;CODE&gt;Barcodes&lt;/CODE&gt;   and  Throttle period is  1 day.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/Alert/Alertexamples#Throttle_the_real-time_alert"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/Alert/Alertexamples#Throttle_the_real-time_alert&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 13:11:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438223#M7642</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-01-31T13:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Alert Query</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438224#M7643</link>
      <description>&lt;P&gt;You can find duplicate barcodes using a query like this one.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search for barcodes&amp;gt; earliest=@d | stats count by Barcodes | where count &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Prevent multiple alerts by using the Throttle option in the alert configuration.  &lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 15:46:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438224#M7643</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-01-31T15:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Alert Query</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438225#M7644</link>
      <description>&lt;P&gt;@DMohn &lt;BR /&gt;
Thank you very much the reply&lt;BR /&gt;
My log snippet looks like below&lt;BR /&gt;
Error Code : 5010 | Barcodes 000323334011 |&lt;BR /&gt;
if the above mentioned Barcode is repeating twice then I should raise an alert,&lt;/P&gt;

&lt;P&gt;The barcode can change frequently.&lt;/P&gt;

&lt;P&gt;Can you please suggest.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 12:53:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438225#M7644</guid>
      <dc:creator>FayazAhmed</dc:creator>
      <dc:date>2019-02-01T12:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Alert Query</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438226#M7645</link>
      <description>&lt;P&gt;Hi @kamlesh_vaghela &lt;/P&gt;

&lt;P&gt;Thank you for the help,&lt;/P&gt;

&lt;P&gt;The search didn't help my query&lt;/P&gt;

&lt;P&gt;My log snippet looks like below&lt;BR /&gt;
Error Code : 5010 | Barcodes 000323334011 |&lt;BR /&gt;
if the above mentioned Barcode is repeating twice then I should raise an alert,&lt;/P&gt;

&lt;P&gt;The barcode can change frequently.&lt;/P&gt;

&lt;P&gt;Can you please suggest.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 12:54:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438226#M7645</guid>
      <dc:creator>FayazAhmed</dc:creator>
      <dc:date>2019-02-01T12:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Alert Query</title>
      <link>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438227#M7646</link>
      <description>&lt;P&gt;@FayazAhmed Please use the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;base search&amp;gt; | rex field=_raw "Error\sCode\s\:\s(?&amp;lt;error_code&amp;gt;[\d]+)\s\|\sBarcodes\s(?&amp;lt;barcodes&amp;gt;[\d]+)\s" | where error_code=2010 | stats count by barcodes | where count &amp;gt; 1 | table barcodes
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It should do exactly what you want. Just replace the &lt;CODE&gt;&amp;lt;base search&amp;gt;&lt;/CODE&gt; part with a search that shows your desired logs (like &lt;CODE&gt;index=mylogs sourcetype=barcode_errors&lt;/CODE&gt; or similar). &lt;/P&gt;

&lt;P&gt;Then use the "Save as" link in the right top above the search bar, save as Alert, set a schedule time as desired, set the trigger condition to "number of results" greater than 0, set to alert for each result, and set throtteling to 1 day. &lt;/P&gt;

&lt;P&gt;Happy Splunking!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 10:24:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Alert-Query/m-p/438227#M7646</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2019-02-05T10:24:30Z</dc:date>
    </item>
  </channel>
</rss>

