<?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: How to edit my search to trigger an alert based on an error message field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-trigger-an-alert-based-on-an-error/m-p/208902#M60989</link>
    <description>&lt;P&gt;Hi splunker9999,&lt;BR /&gt;
Initially I suggest to you to use double quotes around source &lt;CODE&gt;source="/logs/web/jboss/*/logs/*_s2.log"&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;After I suggest to build your error message (e.g.: &lt;CODE&gt;| eval mail_message=_time+" "+host+" "+source+" "+Errormessage&lt;/CODE&gt;) and pass it to the eMail in only one field.&lt;BR /&gt;
The problem is that in the mail body you can pass only the first record, if you need to pass more than one you have to use an attachment (pdf or csv).&lt;/P&gt;

&lt;P&gt;In addition beware to the body or attachment dimensions, because if they exceed your eMail limits, eMail will be blocked.&lt;/P&gt;

&lt;P&gt;Beware to the Errormessage: the first one you showed is wrong , the correct one is the second &lt;CODE&gt;Errormessage="The connection was disconnected because of server shutdown"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 27 Dec 2016 15:23:04 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2016-12-27T15:23:04Z</dc:date>
    <item>
      <title>How to edit my search to trigger an alert based on an error message field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-trigger-an-alert-based-on-an-error/m-p/208901#M60988</link>
      <description>&lt;P&gt;Hi , we need to create an alert and trigger this to my team. Being that below is my search base query looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ios sourcetype=m1log  source=/logs/web/jboss/*/logs/*_s2.log "Connection failure has been detected”  OR "The connection was disconnected because of server shutdown”
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and now we need to trigger this in a table format in email with below fields&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time  host   source    Errormessage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For Errormessage field can we do like this, would this give my expected result or we need to tweak any thing in eval?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval Errormessage=Connection failure has been detected|eval Errormessage="The connection was disconnected because of server shutdown"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 14:55:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-trigger-an-alert-based-on-an-error/m-p/208901#M60988</guid>
      <dc:creator>splunker9999</dc:creator>
      <dc:date>2016-12-27T14:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to trigger an alert based on an error message field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-trigger-an-alert-based-on-an-error/m-p/208902#M60989</link>
      <description>&lt;P&gt;Hi splunker9999,&lt;BR /&gt;
Initially I suggest to you to use double quotes around source &lt;CODE&gt;source="/logs/web/jboss/*/logs/*_s2.log"&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;After I suggest to build your error message (e.g.: &lt;CODE&gt;| eval mail_message=_time+" "+host+" "+source+" "+Errormessage&lt;/CODE&gt;) and pass it to the eMail in only one field.&lt;BR /&gt;
The problem is that in the mail body you can pass only the first record, if you need to pass more than one you have to use an attachment (pdf or csv).&lt;/P&gt;

&lt;P&gt;In addition beware to the body or attachment dimensions, because if they exceed your eMail limits, eMail will be blocked.&lt;/P&gt;

&lt;P&gt;Beware to the Errormessage: the first one you showed is wrong , the correct one is the second &lt;CODE&gt;Errormessage="The connection was disconnected because of server shutdown"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 15:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-trigger-an-alert-based-on-an-error/m-p/208902#M60989</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-12-27T15:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to trigger an alert based on an error message field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-trigger-an-alert-based-on-an-error/m-p/208903#M60990</link>
      <description>&lt;P&gt;Because there will be only one error message in one event, you don't want to create plain eval (BTW, in your eval statement, you're overwriting first message with 2nd, so your results will always show 2nd message), use the conditional eval based on raw data, something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ios sourcetype=m1log  source=/logs/web/jboss/*/logs/*_s2.log "Connection failure has been detected"  OR "The connection was disconnected because of server shutdown" | eval ErrorMessage=if(searchmatch("Connection failure has been detected"),"Connection failure has been detected","The connection was disconnected because of server shutdown") | table _time host source Errormessage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another option will be to extract the error message from raw data using rex command, but for that we need some sample events.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 15:23:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-trigger-an-alert-based-on-an-error/m-p/208903#M60990</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-27T15:23:07Z</dc:date>
    </item>
  </channel>
</rss>

