<?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: Customized Query in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640130#M16069</link>
    <description>&lt;P&gt;You are already there, just set it as an alert with "Number of Results is greater than 0":&lt;BR /&gt;&lt;BR /&gt;index="_internal" AND sourcetype="splunkd_access" AND Http&lt;BR /&gt;| rex "HTTP\/\S+\"\s+(?&amp;lt;responseHttp&amp;gt;\d\d\d)\s+"&lt;BR /&gt;| eval result=if(like(responseHttp, "200"), "Success", "error")&lt;BR /&gt;| stats count(eval(result="Success")) AS Total_Success, count(responseHttp) AS Total&lt;BR /&gt;| eval Success_Count=(Total_Success/Total)*100.0&lt;BR /&gt;| stats avg(Success_Count) AS SuccessRate&lt;BR /&gt;| where SuccessRate&amp;lt;40&lt;BR /&gt;| eval message="SuccessRate is low, please take action."&lt;/P&gt;</description>
    <pubDate>Sun, 16 Apr 2023 20:23:15 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2023-04-16T20:23:15Z</dc:date>
    <item>
      <title>How to create an alert when SuccessRate is Less than 40, and then it should trigger an email alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640020#M16049</link>
      <description>&lt;P&gt;From the below query i want to get the alert when SuccessRate is Less than 40, it should trigger an email alert with customise message like "SuccessRate is less than 40 %, please take action."&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;how can i do this??&lt;BR /&gt;&lt;BR /&gt;index=app-code host_ip=34.23.234.12&lt;BR /&gt;|search activity=done&lt;BR /&gt;|eval result=if(like(responseHttp, "200"), "Success", "error")&lt;BR /&gt;|stats count (eval(result="Success")) as Total_Success, count(responseHttp) as Total&lt;BR /&gt;|eval Success_Count=(Total_Success/Total)*100.0&lt;BR /&gt;|stats avg(Success_Count) as SuccessRate&lt;BR /&gt;|where SuccessRate &amp;lt;40&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 21:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640020#M16049</guid>
      <dc:creator>Ash1</dc:creator>
      <dc:date>2023-04-17T21:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Customized Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640029#M16050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/250479"&gt;@Ash1&lt;/a&gt;&amp;nbsp;please check this Alerts documentation.. you can look for "tokens" in this pdf file..&lt;/P&gt;&lt;P&gt;let us know if you are stuck, we can help you.. thanks..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.2/Alert/Aboutalerts" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.2/Alert/Aboutalerts&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Alert/Setupalertactions" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.4/Alert/Emailnotification&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Alert/Setupalertactions" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Alert/Setupalertactions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 22:15:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640029#M16050</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2023-04-14T22:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Customized Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640040#M16053</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80737"&gt;@inventsekar&lt;/a&gt;&amp;nbsp; here the message i want to display in mail is static message which is not mentioned in my logs to use tokens.&lt;/P&gt;&lt;P&gt;At the end of my query i tried to use&lt;/P&gt;&lt;P&gt;|Eval SuccesRate=if(Success rate&amp;lt;40, "SuccessRate is low, please take action." )&lt;/P&gt;&lt;P&gt;But this is not working&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Apr 2023 02:43:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640040#M16053</guid>
      <dc:creator>Ash1</dc:creator>
      <dc:date>2023-04-15T02:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Customized Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640042#M16054</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=app-code host_ip=34.23.234.12
|search activity=done
|eval result=if(like(responseHttp, "200"), "Success", "error")
|stats count (eval(result="Success")) as Total_Success, count(responseHttp) as Total
|eval Success_Count=(Total_Success/Total)*100.0
|stats avg(Success_Count) as SuccessRate
|where SuccessRate &amp;lt;40&lt;/LI-CODE&gt;&lt;P&gt;you mean, this search query is not working ah.. pls run this search query line by line, so that you can understand which part of this query didnt work..&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Apr 2023 03:22:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640042#M16054</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2023-04-15T03:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Customized Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640106#M16064</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/80737"&gt;@inventsekar&lt;/a&gt;&amp;nbsp;, my query is working but i want to display customised message in the email when success percentage is less than 40.&lt;/P&gt;&lt;P&gt;For that i tried adding the below eval to the end of my query, but this message is not showing up when i run in splunk.&lt;/P&gt;&lt;P&gt;|Eval SuccesRate=if(Success rate&amp;lt;40, "SuccessRate is low, please take action." )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do it???&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2023 01:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640106#M16064</guid>
      <dc:creator>Ash1</dc:creator>
      <dc:date>2023-04-16T01:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Customized Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640107#M16065</link>
      <description>&lt;P&gt;1). Ur query is working fine. Good..&lt;/P&gt;&lt;P&gt;2). Is the the alerts working as expected?&lt;/P&gt;&lt;P&gt;3). When alert fire, you want the subject line or the body.. which one you want to customize&lt;/P&gt;&lt;P&gt;4) did you try the tokens(&amp;nbsp; $variable$ ) idea..&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2023 01:59:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640107#M16065</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2023-04-16T01:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Customized Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640130#M16069</link>
      <description>&lt;P&gt;You are already there, just set it as an alert with "Number of Results is greater than 0":&lt;BR /&gt;&lt;BR /&gt;index="_internal" AND sourcetype="splunkd_access" AND Http&lt;BR /&gt;| rex "HTTP\/\S+\"\s+(?&amp;lt;responseHttp&amp;gt;\d\d\d)\s+"&lt;BR /&gt;| eval result=if(like(responseHttp, "200"), "Success", "error")&lt;BR /&gt;| stats count(eval(result="Success")) AS Total_Success, count(responseHttp) AS Total&lt;BR /&gt;| eval Success_Count=(Total_Success/Total)*100.0&lt;BR /&gt;| stats avg(Success_Count) AS SuccessRate&lt;BR /&gt;| where SuccessRate&amp;lt;40&lt;BR /&gt;| eval message="SuccessRate is low, please take action."&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2023 20:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-create-an-alert-when-SuccessRate-is-Less-than-40-and-then/m-p/640130#M16069</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2023-04-16T20:23:15Z</dc:date>
    </item>
  </channel>
</rss>

