<?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 write a query to find when certain log pattern are not present in the raw logs? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-write-a-query-to-find-when-certain-log-pattern-are-not/m-p/555286#M10573</link>
    <description>&lt;P&gt;Hi All, I have requirement to create an alert.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Condition:&lt;/P&gt;&lt;P&gt;In the raw data when certain log Pattern are not found then it should trigger an alert.&lt;/P&gt;&lt;P&gt;Log Pattern details&lt;/P&gt;&lt;P&gt;INFO construct_email body done successfully&amp;nbsp;&lt;/P&gt;&lt;P&gt;INFO Email notification sent successfully&amp;nbsp;&lt;/P&gt;&lt;P&gt;Query built like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=test sourcetype=test1 (source= cloudwatch/aws/lambda/BLK OR source=cloudwatch/aws/lambda/PRD OR source=cloudwatch/aws/lambda/add)&lt;/P&gt;&lt;P&gt;| eval alert=case(match(_raw,"INFO construct_email body done successfully") AND match(_raw,"INFO Email notification sent successfully"),"No Email sent")&lt;/P&gt;&lt;P&gt;| stats count by alert | where count =0&amp;nbsp;&lt;/P&gt;&lt;P&gt;But not getting any output, so can any one guide me on how built the query to fetch the desired results.&lt;/P&gt;&lt;P&gt;thanks in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jun 2021 11:01:18 GMT</pubDate>
    <dc:creator>Hemnaath</dc:creator>
    <dc:date>2021-06-10T11:01:18Z</dc:date>
    <item>
      <title>How to write a query to find when certain log pattern are not present in the raw logs?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-write-a-query-to-find-when-certain-log-pattern-are-not/m-p/555286#M10573</link>
      <description>&lt;P&gt;Hi All, I have requirement to create an alert.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Condition:&lt;/P&gt;&lt;P&gt;In the raw data when certain log Pattern are not found then it should trigger an alert.&lt;/P&gt;&lt;P&gt;Log Pattern details&lt;/P&gt;&lt;P&gt;INFO construct_email body done successfully&amp;nbsp;&lt;/P&gt;&lt;P&gt;INFO Email notification sent successfully&amp;nbsp;&lt;/P&gt;&lt;P&gt;Query built like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=test sourcetype=test1 (source= cloudwatch/aws/lambda/BLK OR source=cloudwatch/aws/lambda/PRD OR source=cloudwatch/aws/lambda/add)&lt;/P&gt;&lt;P&gt;| eval alert=case(match(_raw,"INFO construct_email body done successfully") AND match(_raw,"INFO Email notification sent successfully"),"No Email sent")&lt;/P&gt;&lt;P&gt;| stats count by alert | where count =0&amp;nbsp;&lt;/P&gt;&lt;P&gt;But not getting any output, so can any one guide me on how built the query to fetch the desired results.&lt;/P&gt;&lt;P&gt;thanks in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 11:01:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-write-a-query-to-find-when-certain-log-pattern-are-not/m-p/555286#M10573</guid>
      <dc:creator>Hemnaath</dc:creator>
      <dc:date>2021-06-10T11:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query to find when certain log pattern are not present in the raw logs?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-write-a-query-to-find-when-certain-log-pattern-are-not/m-p/555288#M10574</link>
      <description>&lt;P&gt;Not sure what you are trying to achieve here&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| eval alert=case(match(_raw,"INFO construct_email body done successfully") AND match(_raw,"INFO Email notification sent successfully"),"No Email sent")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can _raw match both strings at the same time i.e. for the same event? If not, alert is never set to "No Email sent" and will always be null. If alert is null &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| stats count by alert&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;will have no events left in the pipeline and count won't exist for the where clause to check.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Having said that, splunk is not smart enough to know what is not in your events, you have to tell it what specifically to look for.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 11:12:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-write-a-query-to-find-when-certain-log-pattern-are-not/m-p/555288#M10574</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-10T11:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a query to find when certain log pattern are not present in the raw logs?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-write-a-query-to-find-when-certain-log-pattern-are-not/m-p/555312#M10575</link>
      <description>&lt;P&gt;thanks for you quick response on this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hey I am trying to capture the event logs which does not contain the two event pattern from the raw events.&lt;/P&gt;&lt;P&gt;Log Pattern&lt;/P&gt;&lt;P&gt;INFO construct_email body done successfully&lt;/P&gt;&lt;P&gt;INFO Email notification sent successfully&lt;/P&gt;&lt;P&gt;currently I don't see any events&amp;nbsp; which are not having these two pattern in the raw data in our test environment.&amp;nbsp; All the events contains the above two pattern of logs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per the client there is a chance of failure of not sending the email, so told to capture the events which are not having this pattern. I am not sure how to capture those event using the SPL query when there is no failure events found in the raw log.&lt;/P&gt;&lt;P&gt;So can you guide me in building some logic to achieve the end result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 14:10:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-write-a-query-to-find-when-certain-log-pattern-are-not/m-p/555312#M10575</guid>
      <dc:creator>Hemnaath</dc:creator>
      <dc:date>2021-06-10T14:10:11Z</dc:date>
    </item>
  </channel>
</rss>

