<?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 of values per event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346902#M102712</link>
    <description>&lt;P&gt;Hello!&lt;BR /&gt;
Try replacing the last - stats part of your query with this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by dst_port 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 13 Mar 2018 09:40:01 GMT</pubDate>
    <dc:creator>bangalorep</dc:creator>
    <dc:date>2018-03-13T09:40:01Z</dc:date>
    <item>
      <title>count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346900#M102710</link>
      <description>&lt;P&gt;Hi All ,&lt;/P&gt;

&lt;P&gt;i have an event as below&lt;/P&gt;

&lt;P&gt;Date first seen Duration Proto Src IP Addr:Port Dst IP Addr:Port Packets Bytes Flows&lt;BR /&gt;
2018-03-06 12:07:31.427 0.002 TCP 10.96.164.13:55796 -&amp;gt; 10.75.77.56:445 3 132 1&lt;BR /&gt;
2018-03-06 12:07:31.430 0.001 TCP 10.96.164.13:55805 -&amp;gt; 10.75.77.1:445 3 132 1&lt;BR /&gt;
2018-03-06 12:07:31.431 0.001 TCP 10.96.164.13:55806 -&amp;gt; 10.75.77.1:445 3 220 1&lt;BR /&gt;
2018-03-06 12:07:34.437 0.001 TCP 10.96.164.13:56129 -&amp;gt; 10.75.77.1:445 3 269 1&lt;BR /&gt;
2018-03-06 12:07:34.498 0.002 TCP 10.96.164.13:56134 -&amp;gt; 10.75.77.2:445 3 132 1&lt;BR /&gt;
2018-03-06 12:07:34.500 0.001 TCP 10.96.164.13:56135 -&amp;gt; 10.75.77.2:445 3 220 1&lt;BR /&gt;
2018-03-06 12:07:37.510 0.000 TCP 10.96.164.13:56489 -&amp;gt; 10.75.77.2:445 3 269 1&lt;BR /&gt;
2018-03-06 12:07:37.571 0.001 TCP 10.96.164.13:56490 -&amp;gt; 10.75.77.3:445 3 132 1&lt;BR /&gt;
2018-03-06 12:07:37.573 0.002 TCP 10.96.164.13:56491 -&amp;gt; 10.75.77.3:445 3 220 1&lt;BR /&gt;
2018-03-06 12:07:40.581 0.003 TCP 10.96.164.13:56863 -&amp;gt; 10.75.77.3:445 3 269 1&lt;BR /&gt;
2018-03-06 12:07:40.645 0.002 TCP 10.96.164.13:56872 -&amp;gt; 10.75.77.4:445 3 132 1&lt;BR /&gt;
2018-03-06 12:07:40.646 0.002 TCP 10.96.164.13:56873 -&amp;gt; 10.75.77.4:445 3 220 1&lt;BR /&gt;
2018-03-06 12:07:43.655 0.001 TCP 10.96.164.13:57193 -&amp;gt; 10.75.77.4:445 3 269 1&lt;BR /&gt;
2018-03-06 12:07:43.717 0.002 TCP 10.96.164.13:57195 -&amp;gt; 10.75.77.5:445 3 132 1&lt;BR /&gt;
2018-03-06 12:07:43.719 0.002 TCP 10.96.164.13:57196 -&amp;gt; 10.75.77.5:445 3 220 1&lt;BR /&gt;
2018-03-06 12:07:46.728 0.001 TCP 10.96.164.13:57575 -&amp;gt; 10.75.77.5:445 3 269 1&lt;BR /&gt;
...&lt;BR /&gt;
2018-03-06 12:16:02.280 0.577 TCP 10.96.164.13:49972 -&amp;gt; 10.75.77.240:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:03.356 1.014 TCP 10.96.164.13:50104 -&amp;gt; 10.75.77.241:445 3 152 1&lt;BR /&gt;
2018-03-06 12:16:04.433 0.562 TCP 10.96.164.13:50234 -&amp;gt; 10.75.77.242:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:05.509 0.561 TCP 10.96.164.13:50361 -&amp;gt; 10.75.77.243:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:06.586 0.576 TCP 10.96.164.13:50489 -&amp;gt; 10.75.77.244:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:07.662 0.607 TCP 10.96.164.13:50616 -&amp;gt; 10.75.77.245:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:08.741 0.559 TCP 10.96.164.13:50745 -&amp;gt; 10.75.77.246:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:09.815 0.577 TCP 10.96.164.13:50835 -&amp;gt; 10.75.77.247:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:10.891 0.609 TCP 10.96.164.13:50966 -&amp;gt; 10.75.77.248:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:11.968 0.998 TCP 10.96.164.13:51096 -&amp;gt; 10.75.77.249:445 3 152 1&lt;BR /&gt;
2018-03-06 12:16:13.044 1.014 TCP 10.96.164.13:51225 -&amp;gt; 10.75.77.250:445 3 152 1&lt;BR /&gt;
2018-03-06 12:16:14.121 0.578 TCP 10.96.164.13:51356 -&amp;gt; 10.75.77.251:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:15.196 0.998 TCP 10.96.164.13:51484 -&amp;gt; 10.75.77.252:445 3 152 1&lt;BR /&gt;
2018-03-06 12:16:16.273 0.515 TCP 10.96.164.13:51623 -&amp;gt; 10.75.77.253:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:17.349 0.546 TCP 10.96.164.13:51751 -&amp;gt; 10.75.77.254:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:18.536 0.530 TCP 10.96.164.13:51879 -&amp;gt; 10.75.52.94:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:19.658 0.999 TCP 10.96.164.13:52009 -&amp;gt; 10.75.41.195:445 3 152 1&lt;BR /&gt;
2018-03-06 12:16:20.782 0.576 TCP 10.96.164.13:52142 -&amp;gt; 10.75.33.196:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:21.913 0.561 TCP 10.96.164.13:52272 -&amp;gt; 10.75.249.84:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:23.029 0.000 TCP 10.96.164.13:52403 -&amp;gt; 10.75.22.193:445 1 52 1&lt;BR /&gt;
2018-03-06 12:16:24.158 0.000 TCP 10.96.164.13:52531 -&amp;gt; 10.75.137.51:445 1 52 1&lt;BR /&gt;
2018-03-06 12:16:25.280 0.515 TCP 10.96.164.13:52659 -&amp;gt; 10.75.207.231:445 2 104 1&lt;BR /&gt;
2018-03-06 12:16:26.408 0.000 TCP 10.96.164.13:52791 -&amp;gt; 10.75.152.227:445 1 52 1&lt;/P&gt;

&lt;P&gt;I need the count of each port in the event.&lt;/P&gt;

&lt;P&gt;index=* 1520558807000 | rex field=_raw max_match=0 "([[ipv4]])"   | rex field=_raw max_match=0 "(?\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}:\d{1,5})"   | rex field=IP_add "(?[^:]+):(?\d+)" |eval eventportcnt=mvcount(dst_port) | where eventportcnt &amp;gt;10 |stats values(dst_port) values(eventportcnt)&lt;/P&gt;

&lt;P&gt;The above query gives me the total count of different ports in the event. i am expecting the below output.&lt;/P&gt;

&lt;P&gt;Port                  count&lt;BR /&gt;
445                   40&lt;BR /&gt;
55796              1&lt;/P&gt;

&lt;P&gt;Please help........ &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:25:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346900#M102710</guid>
      <dc:creator>suryaavinash</dc:creator>
      <dc:date>2020-09-29T18:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346901#M102711</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;

&lt;P&gt;Can you try something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=* 1520558807000 | rex field=_raw max_match=0 "([[ipv4]])" | rex field=_raw max_match=0 "(?\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\:\d{1,5})" | rex field=IP_add "(?[^:]+):(?\d+)" |eval eventportcnt=mvcount(dst_port) | where eventportcnt &amp;gt;10 |stats  values(eventportcnt) by dst_port
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Mar 2018 09:33:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346901#M102711</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-03-13T09:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346902#M102712</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;
Try replacing the last - stats part of your query with this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by dst_port 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Mar 2018 09:40:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346902#M102712</guid>
      <dc:creator>bangalorep</dc:creator>
      <dc:date>2018-03-13T09:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346903#M102713</link>
      <description>&lt;P&gt;@suryaavinash, can you please explain your required output a bit more as to what you want to capture as count?&lt;/P&gt;

&lt;P&gt;I see one Destination Port 445 with count 40 and one Source Port with count 1? Is there a correlation between the source and destination that you want to establish?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 09:47:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346903#M102713</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-13T09:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346904#M102714</link>
      <description>&lt;P&gt;hi niket,&lt;/P&gt;

&lt;P&gt;When we do a regex , it gets me all the IP's and Port's.&lt;BR /&gt;
if you see the _raw event above , it has around 40 IP's with port 445 and server IP's(40) with 1 Port.&lt;/P&gt;

&lt;P&gt;When i am doing a mvcount(dst_port) ,  i am getting a total count of 80 . what i am expecting is individual count of port's for a single event like&lt;/P&gt;

&lt;P&gt;Port count&lt;BR /&gt;
445 40&lt;BR /&gt;
55796 1&lt;BR /&gt;
52791 1&lt;BR /&gt;
.......&lt;BR /&gt;
........&lt;/P&gt;

&lt;P&gt;Thanks for the help,&lt;BR /&gt;
Surya&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 10:19:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346904#M102714</guid>
      <dc:creator>suryaavinash</dc:creator>
      <dc:date>2018-03-13T10:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346905#M102715</link>
      <description>&lt;P&gt;I remember doing this , whats happening is &lt;BR /&gt;
if eventportcnt =80 then that is being mapped for all the Ports&lt;/P&gt;

&lt;P&gt;Port count&lt;BR /&gt;
445     80&lt;BR /&gt;
55796 80&lt;BR /&gt;
52791 80&lt;/P&gt;

&lt;P&gt;I will try it once again tomorrow and update you in case it works . Thanks for helping.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 10:21:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346905#M102715</guid>
      <dc:creator>suryaavinash</dc:creator>
      <dc:date>2018-03-13T10:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346906#M102716</link>
      <description>&lt;P&gt;Stats count by dst_port gets you the result from all the events and not from the specific event.&lt;/P&gt;

&lt;P&gt;In my case i want the count of ports in a single event. Thanks for helping.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 10:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346906#M102716</guid>
      <dc:creator>suryaavinash</dc:creator>
      <dc:date>2018-03-13T10:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346907#M102717</link>
      <description>&lt;P&gt;This works fine for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test111"  | rex field=_raw max_match=0 "([[ipv4]])" | rex field=_raw max_match=0 "(?&amp;lt;IP_add&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5})" | rex field=IP_add "(?&amp;lt;ip_1&amp;gt;[^:]+):(?&amp;lt;dst_port&amp;gt;\d+)" | stats count by dst_port
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Mar 2018 10:38:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346907#M102717</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-03-13T10:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346908#M102718</link>
      <description>&lt;P&gt;this gives the result for the entire index. i want the cunt for single event. Same answer was advised below &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 11:16:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346908#M102718</guid>
      <dc:creator>suryaavinash</dc:creator>
      <dc:date>2018-03-13T11:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346909#M102719</link>
      <description>&lt;P&gt;Try this if you want result in 1 row:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index="test111"  | rex field=_raw max_match=0 "([[ipv4]])" | rex field=_raw max_match=0 "(?&amp;lt;IP_add&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5})" | rex field=IP_add "(?&amp;lt;ip_1&amp;gt;[^:]+):(?&amp;lt;dst_port&amp;gt;\d+)" | stats count AS dst_count by dst_port | stats list(dst_count) list(dst_port)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It will combine result and display in 1 row. Let me know if you need anything?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 11:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346909#M102719</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-03-13T11:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346910#M102720</link>
      <description>&lt;P&gt;You can try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* 1520558807000 | rex field=_raw max_match=0 "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:(?&amp;lt;port&amp;gt;[^\s]+)" | stats count by port
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Mar 2018 11:59:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346910#M102720</guid>
      <dc:creator>vinod94</dc:creator>
      <dc:date>2018-03-13T11:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346911#M102721</link>
      <description>&lt;P&gt;Doesnt work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;list(dst_count) list(dst_port)&lt;BR /&gt;
160                          445&lt;BR /&gt;
4                              49972&lt;BR /&gt;
4                              50104&lt;BR /&gt;
4                              50234&lt;BR /&gt;
.....&lt;BR /&gt;
.......&lt;/P&gt;

&lt;P&gt;160 is the count of occurrence of 445 in the index on all the events. The same result as stats count by dst_port.The expectation is &lt;/P&gt;

&lt;P&gt;445                  40&lt;BR /&gt;
49972              1&lt;BR /&gt;
445                   40&lt;BR /&gt;
49972               1&lt;/P&gt;

&lt;P&gt;i want the count per event. The issue is:&lt;BR /&gt;
single host( 10.96.164.13) is trying to ping several hosts on a single port(445) to spread Malware. I am unable to get any specific pattern out of this . so i am going with the count of ports per event and alerting such incidents.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:26:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346911#M102721</guid>
      <dc:creator>suryaavinash</dc:creator>
      <dc:date>2020-09-29T18:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: count of values per event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346912#M102722</link>
      <description>&lt;P&gt;Stats count by dst_port gets you the result from all the events and not from the specific event.&lt;/P&gt;

&lt;P&gt;In my case i want the count of ports in a single event. Thanks for helping.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 22:34:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/count-of-values-per-event/m-p/346912#M102722</guid>
      <dc:creator>suryaavinash</dc:creator>
      <dc:date>2018-03-13T22:34:37Z</dc:date>
    </item>
  </channel>
</rss>

