<?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 Conditional email subject line in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conditional-email-subject-line/m-p/391434#M113965</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;
I have search&lt;BR /&gt;
index=* ERROR | eval svc=mvindex(split(index,"-"),4) | stats count(svc) as cnt_svc by svc,source | where cnt_svc &amp;gt; 10&lt;/P&gt;

&lt;P&gt;and my result can be for multiple services or for single service:&lt;BR /&gt;
svc              source                  cnt_svc&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;accounts    /data/errors.log      120&lt;BR /&gt;
accounts   /data/system.log       23&lt;BR /&gt;
users          /data/system.log      34&lt;BR /&gt;
orders       /data/errors.log         83 &lt;/P&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;P&gt;svc              source                  cnt_svc&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;accounts    /data/errors.log      120&lt;BR /&gt;
accounts   /data/system.log       23&lt;/P&gt;

&lt;P&gt;My email subject line has to be "Splunk errors for 3 services" in the 1st case or "Splunk errors for accounts" in the 2nd case.&lt;BR /&gt;
Is it possible to do it?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:57:30 GMT</pubDate>
    <dc:creator>ygaluzo</dc:creator>
    <dc:date>2020-09-29T23:57:30Z</dc:date>
    <item>
      <title>Conditional email subject line</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-email-subject-line/m-p/391434#M113965</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I have search&lt;BR /&gt;
index=* ERROR | eval svc=mvindex(split(index,"-"),4) | stats count(svc) as cnt_svc by svc,source | where cnt_svc &amp;gt; 10&lt;/P&gt;

&lt;P&gt;and my result can be for multiple services or for single service:&lt;BR /&gt;
svc              source                  cnt_svc&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;accounts    /data/errors.log      120&lt;BR /&gt;
accounts   /data/system.log       23&lt;BR /&gt;
users          /data/system.log      34&lt;BR /&gt;
orders       /data/errors.log         83 &lt;/P&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;P&gt;svc              source                  cnt_svc&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;accounts    /data/errors.log      120&lt;BR /&gt;
accounts   /data/system.log       23&lt;/P&gt;

&lt;P&gt;My email subject line has to be "Splunk errors for 3 services" in the 1st case or "Splunk errors for accounts" in the 2nd case.&lt;BR /&gt;
Is it possible to do it?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:57:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-email-subject-line/m-p/391434#M113965</guid>
      <dc:creator>ygaluzo</dc:creator>
      <dc:date>2020-09-29T23:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional email subject line</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-email-subject-line/m-p/391435#M113966</link>
      <description>&lt;P&gt;Add this line to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats count as totalcount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you should have an additional column "totalcount", which is 4 in this example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;svc       source            cnt_svc  totalcount
accounts  /data/errors.log  120      4
accounts  /data/system.log  23       4
users     /data/system.log  34       4
orders    /data/errors.log  83       4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now change the email subject line of your alert to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Splunk errors for $result.totalcount$ services
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Apr 2019 06:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-email-subject-line/m-p/391435#M113966</guid>
      <dc:creator>whrg</dc:creator>
      <dc:date>2019-04-05T06:35:39Z</dc:date>
    </item>
  </channel>
</rss>

