<?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: Count a value by a value without stats? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-a-value-by-a-value-without-stats/m-p/413719#M119233</link>
    <description>&lt;P&gt;@brienhawker &lt;/P&gt;

&lt;P&gt;Have you tried &lt;CODE&gt;eventstats&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/eventstats"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/eventstats&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Eg.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Number of recipients by the number of senders&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH |eventstats dc(recipient) as NumberOfRecipient by sender 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 Apr 2019 09:03:30 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2019-04-12T09:03:30Z</dc:date>
    <item>
      <title>Count a value by a value without stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-a-value-by-a-value-without-stats/m-p/413718#M119232</link>
      <description>&lt;P&gt;Im currently trying to build a search where im trying to determine if a user is trying to send data out maliciously. One of the things that i am trying to do is count the number of recipients by the number of senders before the stats line so that I can use that data in an eval giving me a threat number between 1 and 5&lt;/P&gt;

&lt;P&gt;index=msexchange size&amp;gt;2000000 directionality="Originating" AND action="delivered" AND recipient!="&lt;EM&gt;iccu.com" AND NOT&lt;BR /&gt;
(message_subject="RE&lt;/EM&gt;" OR message_subject="FW*" OR message_subject="&lt;EM&gt;EXTERNAL&lt;/EM&gt;") AND&lt;BR /&gt;
(recipient="&lt;EM&gt;gmail.com" OR recipient="&lt;/EM&gt;.edu" OR recipient="&lt;EM&gt;hotmail.com" OR recipient "*yahoo.com" OR recipient="*msn.com" OR &lt;BR /&gt;
recipient="*outlook.com" OR recipient="*aol.com" OR recipient="*zoho.com" OR recipient="*icloud.com" OR recipient="*inbox.com" OR recipient="*mail.com" OR recipient="*yandex.com" OR recipient="*protonmail.com")&lt;BR /&gt;
|eval threat_num=5&lt;BR /&gt;
**somewhere in here i am needing to count the recipients by the senders so that i can do an eval to determine the value of diff&lt;/EM&gt;*&lt;BR /&gt;
|eval appraise=if(like(message_subject, "%ppraisal%"), 2, 0)&lt;BR /&gt;
|eval payment=if(like(message_subject, "%ayment%"), 2, 0)&lt;BR /&gt;
|eval loan=if(like(message_subject, "%oan%"), 2, 0)&lt;BR /&gt;
|eval diff=(threat_num - appraise - payment - loan)&lt;BR /&gt;
|stats values(size) as "Message Size" list(diff)  values(message_subject) values(title) values(recipient) as Recipient by sender  | sort -"Message Size"&lt;/P&gt;

&lt;P&gt;Ive looked into using mvcount but it doesnt appear that you can use a 'by' value in it. Anything helps.&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:08:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-a-value-by-a-value-without-stats/m-p/413718#M119232</guid>
      <dc:creator>brienhawker</dc:creator>
      <dc:date>2020-09-30T00:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Count a value by a value without stats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-a-value-by-a-value-without-stats/m-p/413719#M119233</link>
      <description>&lt;P&gt;@brienhawker &lt;/P&gt;

&lt;P&gt;Have you tried &lt;CODE&gt;eventstats&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/eventstats"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/eventstats&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Eg.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Number of recipients by the number of senders&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH |eventstats dc(recipient) as NumberOfRecipient by sender 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Apr 2019 09:03:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-a-value-by-a-value-without-stats/m-p/413719#M119233</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-04-12T09:03:30Z</dc:date>
    </item>
  </channel>
</rss>

