<?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 avoid the search parameter in email alerts in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29886#M286</link>
    <description>&lt;P&gt;Above solution doesn't work for me (Splunk 5.0.4) but I found a way to accomplish this very nicely by changing just one file instead of two&lt;/P&gt;

&lt;P&gt;Edit ../etc/apps/search/bin/sendemail.py and comment out lines #189-213 as shown below.&lt;BR /&gt;
(you'll need to change the file permissions from read-only first)&lt;BR /&gt;
No need to restart Splunk, the change will be picked up at the next Alert&lt;BR /&gt;
The "inline" alerts will show only the search results without any additional text. &lt;BR /&gt;
The PDF or CSV alerts are not impacted by this change&lt;/P&gt;

&lt;P&gt;sendemail.py section.....line 189&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; # else:
 #   intro += "Saved search results.\n\n"

  #  if settings != None:
  #      user  = settings.get("user", None)
  #     if user:
  #          intro += "User: \'" + escape(user, plainText) + "\'\n"

 #   if ssName:
 #      intro += "Name: \'" + escape(ssName, plainText) + "\'\n"

  #  query = getarg(argvals, "ssquery", None)
  #  if query:
  #      intro += "Query Terms: \'" + escape(query, plainText) + "\'\n"

  #  ssLink = getarg(argvals, "sslink", None)
  #  if ssLink and not plainText:
  #      ssLink = "&amp;lt;a href=\"" + ssLink + "\"&amp;gt;" + ssLink + "&amp;lt;/a&amp;gt;"

  #  if ssLink:
  #      intro += "Link to results: " + ssLink + "\n";

  #  ssSummary = getarg(argvals, "sssummary", None)
  #  if ssSummary:
  #     intro += "Alert was triggered because of: \'" + escape(ssSummary, plainText) + "\'\n"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Sep 2013 14:15:06 GMT</pubDate>
    <dc:creator>Ovi</dc:creator>
    <dc:date>2013-09-18T14:15:06Z</dc:date>
    <item>
      <title>How to avoid the search parameter in email alerts</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29883#M283</link>
      <description>&lt;P&gt;Hi everybody.&lt;BR /&gt;
I´ve configured a lot of email alerts in splunk. The problem I see, is when an alert triggered and I received I see the information plus the configured Search string that triggered the alert. &lt;BR /&gt;
I would like to receive only the results.&lt;/P&gt;

&lt;P&gt;Below is an example of the alert I receive by email&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Saved search results. &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Name: 'ANTIVIRUS - Reporte de actualizacion (Servidores)' &lt;BR /&gt;
Query Terms: 'sourcetype=\"WMI:WinEventLog:Application\" EventCode=7 |dedup ComputerName | chart count(ComputerName) over ComputerName by virus_defs' &lt;BR /&gt;
Link to results: &lt;A href="https://hostname:8000/app/Liberty/@go?sid=scheduler__pstamati__Liberty_QU5USVZJUlVTIC0gUmVwb3J0ZSBkZSBhY3R1YWxpemFjaW9uIChTZXJ2aWRvcmVzKQ_at_1334768100_56cb5ef78e5a1ed1" target="_blank"&gt;https://hostname:8000/app/Liberty/@go?sid=scheduler__pstamati__Liberty_QU5USVZJUlVTIC0gUmVwb3J0ZSBkZSBhY3R1YWxpemFjaW9uIChTZXJ2aWRvcmVzKQ_at_1334768100_56cb5ef78e5a1ed1&lt;/A&gt; &lt;BR /&gt;
Alert was triggered because of: 'Saved Search [ANTIVIRUS - Reporte de actualizacion (Servidores)]: number of events(57)'&lt;/EM&gt; &lt;/P&gt;

&lt;P&gt;&amp;lt;---------I´d like to receive only from here&lt;BR /&gt;
ComputerName|140416r.|140417s.&lt;BR /&gt;&lt;BR /&gt;
AR-AVAYA-RT|0|1&lt;BR /&gt;
AR-BES.Liberty.ar|0|1&lt;BR /&gt;
AR-BSAS-AD1|0|1&lt;BR /&gt;
AR-BSAS-AD2|0|1&lt;BR /&gt;
AR-BSAS-DC1.Liberty.ar|0|1&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29883#M283</guid>
      <dc:creator>pstamati</dc:creator>
      <dc:date>2020-09-28T11:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid the search parameter in email alerts</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29884#M284</link>
      <description>&lt;P&gt;You can modify the alert_actions.conf file located at /etc/system/local&lt;/P&gt;

&lt;P&gt;Add the following to the end of the file (or if there is already a "command=" setting replace it with the one below. This will remove the search query from the results and "should" remove the URL (haven't tested it yet). &lt;/P&gt;

&lt;P&gt;command = sendemail "to=$action.email.to$" "server=$action.email.mailserver{default=localhost}$" "from=$action.email.from{default=splunk@localhost}$" "subject=$action.email.subject{recurse=yes}$" "format=$action.email.format{default=csv}$" "inline=$action.email.inline{default=False}$" "sendresults=$action.email.sendresults{default=False}$"  "sslink=$results.url{default=False}$" "sendpdf=$action.email.sendpdf{default=False}$" "pdfview=$action.email.pdfview$" "searchid=$search_id$" "graceful=$graceful{default=True}$" maxinputs="$maxinputs{default=1000}$" maxtime="$action.email.maxtime{default=5m}$" _validate-1 = action.email.sendresults, validate( is_bool('action.email.sendresults'), "Value of argument 'action.email.sendresults' must be a boolean")&lt;/P&gt;

&lt;P&gt;To get rid of the "Saved search results." you can  edit the sendemail.py file to remove that text. Currently looks like below in the file. If someone knows a better way to not have it show up please let me know.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;intro += "Saved search results.\n\n"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Might have to restart splunk after the change is made.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:41:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29884#M284</guid>
      <dc:creator>cramasta</dc:creator>
      <dc:date>2020-09-28T11:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid the search parameter in email alerts</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29885#M285</link>
      <description>&lt;P&gt;Awsome!! Many Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2012 18:34:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29885#M285</guid>
      <dc:creator>pstamati</dc:creator>
      <dc:date>2012-04-18T18:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid the search parameter in email alerts</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29886#M286</link>
      <description>&lt;P&gt;Above solution doesn't work for me (Splunk 5.0.4) but I found a way to accomplish this very nicely by changing just one file instead of two&lt;/P&gt;

&lt;P&gt;Edit ../etc/apps/search/bin/sendemail.py and comment out lines #189-213 as shown below.&lt;BR /&gt;
(you'll need to change the file permissions from read-only first)&lt;BR /&gt;
No need to restart Splunk, the change will be picked up at the next Alert&lt;BR /&gt;
The "inline" alerts will show only the search results without any additional text. &lt;BR /&gt;
The PDF or CSV alerts are not impacted by this change&lt;/P&gt;

&lt;P&gt;sendemail.py section.....line 189&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; # else:
 #   intro += "Saved search results.\n\n"

  #  if settings != None:
  #      user  = settings.get("user", None)
  #     if user:
  #          intro += "User: \'" + escape(user, plainText) + "\'\n"

 #   if ssName:
 #      intro += "Name: \'" + escape(ssName, plainText) + "\'\n"

  #  query = getarg(argvals, "ssquery", None)
  #  if query:
  #      intro += "Query Terms: \'" + escape(query, plainText) + "\'\n"

  #  ssLink = getarg(argvals, "sslink", None)
  #  if ssLink and not plainText:
  #      ssLink = "&amp;lt;a href=\"" + ssLink + "\"&amp;gt;" + ssLink + "&amp;lt;/a&amp;gt;"

  #  if ssLink:
  #      intro += "Link to results: " + ssLink + "\n";

  #  ssSummary = getarg(argvals, "sssummary", None)
  #  if ssSummary:
  #     intro += "Alert was triggered because of: \'" + escape(ssSummary, plainText) + "\'\n"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Sep 2013 14:15:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-avoid-the-search-parameter-in-email-alerts/m-p/29886#M286</guid>
      <dc:creator>Ovi</dc:creator>
      <dc:date>2013-09-18T14:15:06Z</dc:date>
    </item>
  </channel>
</rss>

