<?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 include client names, error counts, and the error log events that triggered the alert? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-to-include-client-names-error-counts-and/m-p/209766#M3705</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have created an alert where it checks the status of the client accessing the application. The status will be either ERROR or SUCCESS. If the status is SUCCESS, then it is fine, but if it is ERROR, it should count the number of ERROR for particular clients and will pop up an email as an alert with the list of clients and their respective ERROR counts.&lt;/P&gt;

&lt;P&gt;This is the search: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" sourcetype="xyz" STATUS=ERROR CLIENT_ID=*|stats count by CLIENT_ID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example lets say I have 2 clients: &lt;A href="mailto:Amit@xyz.com"&gt;Amit@xyz.com&lt;/A&gt; and &lt;A href="mailto:Jash@xyz.com"&gt;Jash@xyz.com&lt;/A&gt;&lt;BR /&gt;
So the final output which I am receiving as an alert for every 1 hour are:&lt;/P&gt;

&lt;P&gt;Client_ID Count of ERROR&lt;BR /&gt;
&lt;A href="mailto:Amit@xyz.com"&gt;Amit@xyz.com&lt;/A&gt; 2&lt;BR /&gt;
&lt;A href="mailto:Jash@xyz.com"&gt;Jash@xyz.com&lt;/A&gt; 1&lt;/P&gt;

&lt;P&gt;So that means there are 2 errors for &lt;A href="mailto:Amit@xyz.com"&gt;Amit@xyz.com&lt;/A&gt; and 1 error for &lt;A href="mailto:Jash@xyz.com"&gt;Jash@xyz.com&lt;/A&gt; in the log files. So lets say the errors in the log files are:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    2015-12-29 04:05:25 ERROR - [Client ID: Amit@xyz.com] - Client is not configured properly in the database
    2015-12-29 04:06:32 ERROR - [Client ID: Amit@xyz.com] - Client is not having enough permission to access the application

2015-12-29 04:07:21 ERROR - [Client ID: Jash@xyz.com] - SOAP Fault occurred
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My question is, isthere any way to email these above mentioned log file lines along with the ERROR counts for clients in the alert? So the final alert which I should receive should be something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Client_ID Count of ERROR
Amit@xyz.com 2
Jash@xyz.com 1

2015-12-29 04:05:25 ERROR - [Client ID: Amit@xyz.com] - Client is not configured properly in the database
2015-12-29 04:06:32 ERROR - [Client ID: Amit@xyz.com] - Client is not having enough permission to access the application

2015-12-29 04:07:21 ERROR - [Client ID: Jash@xyz.com] - SOAP Fault occurred
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help on this will be greatly appreciated. &lt;/P&gt;</description>
    <pubDate>Tue, 29 Dec 2015 10:26:32 GMT</pubDate>
    <dc:creator>AmitKrJash</dc:creator>
    <dc:date>2015-12-29T10:26:32Z</dc:date>
    <item>
      <title>How to create an alert to include client names, error counts, and the error log events that triggered the alert?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-to-include-client-names-error-counts-and/m-p/209766#M3705</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have created an alert where it checks the status of the client accessing the application. The status will be either ERROR or SUCCESS. If the status is SUCCESS, then it is fine, but if it is ERROR, it should count the number of ERROR for particular clients and will pop up an email as an alert with the list of clients and their respective ERROR counts.&lt;/P&gt;

&lt;P&gt;This is the search: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" sourcetype="xyz" STATUS=ERROR CLIENT_ID=*|stats count by CLIENT_ID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example lets say I have 2 clients: &lt;A href="mailto:Amit@xyz.com"&gt;Amit@xyz.com&lt;/A&gt; and &lt;A href="mailto:Jash@xyz.com"&gt;Jash@xyz.com&lt;/A&gt;&lt;BR /&gt;
So the final output which I am receiving as an alert for every 1 hour are:&lt;/P&gt;

&lt;P&gt;Client_ID Count of ERROR&lt;BR /&gt;
&lt;A href="mailto:Amit@xyz.com"&gt;Amit@xyz.com&lt;/A&gt; 2&lt;BR /&gt;
&lt;A href="mailto:Jash@xyz.com"&gt;Jash@xyz.com&lt;/A&gt; 1&lt;/P&gt;

&lt;P&gt;So that means there are 2 errors for &lt;A href="mailto:Amit@xyz.com"&gt;Amit@xyz.com&lt;/A&gt; and 1 error for &lt;A href="mailto:Jash@xyz.com"&gt;Jash@xyz.com&lt;/A&gt; in the log files. So lets say the errors in the log files are:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    2015-12-29 04:05:25 ERROR - [Client ID: Amit@xyz.com] - Client is not configured properly in the database
    2015-12-29 04:06:32 ERROR - [Client ID: Amit@xyz.com] - Client is not having enough permission to access the application

2015-12-29 04:07:21 ERROR - [Client ID: Jash@xyz.com] - SOAP Fault occurred
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My question is, isthere any way to email these above mentioned log file lines along with the ERROR counts for clients in the alert? So the final alert which I should receive should be something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Client_ID Count of ERROR
Amit@xyz.com 2
Jash@xyz.com 1

2015-12-29 04:05:25 ERROR - [Client ID: Amit@xyz.com] - Client is not configured properly in the database
2015-12-29 04:06:32 ERROR - [Client ID: Amit@xyz.com] - Client is not having enough permission to access the application

2015-12-29 04:07:21 ERROR - [Client ID: Jash@xyz.com] - SOAP Fault occurred
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help on this will be greatly appreciated. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2015 10:26:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-to-include-client-names-error-counts-and/m-p/209766#M3705</guid>
      <dc:creator>AmitKrJash</dc:creator>
      <dc:date>2015-12-29T10:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert to include client names, error counts, and the error log events that triggered the alert?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-to-include-client-names-error-counts-and/m-p/209767#M3706</link>
      <description>&lt;P&gt;If you're happy for them to be in line with with counts Just add the raw values into stats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" sourcetype="xyz" STATUS=ERROR CLIENT_ID=*|stats count values(_raw)  by CLIENT_ID 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See the description for  values(X) in &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/CommonStatsFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/CommonStatsFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2015 13:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-to-include-client-names-error-counts-and/m-p/209767#M3706</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2015-12-29T13:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an alert to include client names, error counts, and the error log events that triggered the alert?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-to-include-client-names-error-counts-and/m-p/209768#M3707</link>
      <description>&lt;P&gt;@jplumsdaine22  Thanks a lot for the help.. It is working for me now. I am able to pull up the entire Error logs in the alert. Is there a way to get the source and the host details in the alert mail from where the logs are getting generated. In the  alert mail body I tried something like this&lt;BR /&gt;&lt;BR /&gt;
Source Log= '$source$' &lt;BR /&gt;
Server = '$host$'&lt;BR /&gt;
but it is not working.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 16:04:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-an-alert-to-include-client-names-error-counts-and/m-p/209768#M3707</guid>
      <dc:creator>AmitKrJash</dc:creator>
      <dc:date>2016-01-11T16:04:34Z</dc:date>
    </item>
  </channel>
</rss>

