<?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 do you include a varying number of a Splunk Search's field values in an email alert? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-include-a-varying-number-of-a-Splunk-Search-s-field/m-p/439425#M124989</link>
    <description>&lt;P&gt;@samsam48,&lt;/P&gt;

&lt;P&gt;If you have definite number for each alert-type for e.g. 5 then you could filter it in the main search itself.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"your search"|fields alert-type,description|eventstats count by  alert-type
|eval description=if(count&amp;gt;5,"",description)|stats values(description) as description,values(count) as count by alert-type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Run anywhere example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_*|fields source,sourcetype|eventstats count by sourcetype|table source,sourcetype,count
|eval source=if(count&amp;gt;100," ",source)|stats values(source) as source,values(count) as count by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 04 Sep 2018 13:41:28 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2018-09-04T13:41:28Z</dc:date>
    <item>
      <title>How do you include a varying number of a Splunk Search's field values in an email alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-include-a-varying-number-of-a-Splunk-Search-s-field/m-p/439424#M124988</link>
      <description>&lt;P&gt;I have a Splunk Search that returns events that have an  &lt;CODE&gt;alert-type&lt;/CODE&gt; field value of "Severe", "Moderate", and "light". Each event also has a corresponding description field  &lt;CODE&gt;description&lt;/CODE&gt; outlining what happened. Within the email alert that I set up, how can I group these events by alert type and then apply logic to display how a certain number of their corresponding descriptions? For example, if the "Severe" group has less than 5 results, display all 5 descriptions in the email. However, if the "Moderate" group has  over 300 results, don't bother showing any descriptions. &lt;/P&gt;

&lt;P&gt;Also, is there an easy way to get counts of these events within the email body logic- like printing to the email body that there were X number of results for each type? Or are these in the search itself?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 13:17:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-include-a-varying-number-of-a-Splunk-Search-s-field/m-p/439424#M124988</guid>
      <dc:creator>samsam48</dc:creator>
      <dc:date>2018-09-04T13:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do you include a varying number of a Splunk Search's field values in an email alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-include-a-varying-number-of-a-Splunk-Search-s-field/m-p/439425#M124989</link>
      <description>&lt;P&gt;@samsam48,&lt;/P&gt;

&lt;P&gt;If you have definite number for each alert-type for e.g. 5 then you could filter it in the main search itself.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"your search"|fields alert-type,description|eventstats count by  alert-type
|eval description=if(count&amp;gt;5,"",description)|stats values(description) as description,values(count) as count by alert-type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Run anywhere example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_*|fields source,sourcetype|eventstats count by sourcetype|table source,sourcetype,count
|eval source=if(count&amp;gt;100," ",source)|stats values(source) as source,values(count) as count by sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Sep 2018 13:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-include-a-varying-number-of-a-Splunk-Search-s-field/m-p/439425#M124989</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-09-04T13:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do you include a varying number of a Splunk Search's field values in an email alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-include-a-varying-number-of-a-Splunk-Search-s-field/m-p/439426#M124990</link>
      <description>&lt;P&gt;@samsam48, did it help you ? If yes, then I would convert it as answer and then you can accept it to close this thread.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 14:39:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-include-a-varying-number-of-a-Splunk-Search-s-field/m-p/439426#M124990</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-09-06T14:39:52Z</dc:date>
    </item>
  </channel>
</rss>

