<?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 edit my search to show the count of a field per country? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302862#M91164</link>
    <description>&lt;P&gt;sorry, i should have known it would sort alphanumerically. try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=cisco-firewall host="" action="" src_ip="" dest_ip="" src_port="" dest_port="" transport="" service="" 
| iplocation src_ip 
| eventstats count by dest_port Country 
| eval dest_port_count=count+" - "+dest_port 
| stats values(dest_port_count) as dest_port_count by Country 
| mvexpand dest_port_count 
| sort 0 Country - dest_port_count 
| streamstats count by Country 
| eval count_dest_port_count=count+" : "+dest_port_count 
| stats values(count_dest_port_count) as count_dest_port_count by Country 
| makemv count_dest_port_count 
| eval dest_port_count=mvfilter(match(count_dest_port_count,"-")) 
| fields - count_dest_port_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 May 2017 11:49:51 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2017-05-19T11:49:51Z</dc:date>
    <item>
      <title>How to edit my search to show the count of a field per country?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302855#M91157</link>
      <description>&lt;P&gt;I have a search below that shows the number of events by Country.  I want to show the count of each dest_port per country.  How do I do this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=cisco-firewall host="*" action="*" src_ip="*" dest_ip="*" src_port="*" dest_port="*" transport="*" service="*" | iplocation src_ip | stats count by Country

Country | Count
------------------------ 
USA     | 150
Canada  | 82 
Mexico  | 11
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 May 2017 17:36:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302855#M91157</guid>
      <dc:creator>bayman</dc:creator>
      <dc:date>2017-05-18T17:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show the count of a field per country?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302856#M91158</link>
      <description>&lt;P&gt;Do you mean  something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=cisco-firewall host="*" action="*" src_ip="*" dest_ip="*" src_port="*" dest_port="*" transport="*" service="*" 
| iplocation src_ip 
| stats count by dest_port Country
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 May 2017 17:38:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302856#M91158</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-05-18T17:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show the count of a field per country?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302857#M91159</link>
      <description>&lt;P&gt;I need it to show Country only once and each dest_port count once for the corresponding country.&lt;BR /&gt;&lt;BR /&gt;
Something like this, but I need it to show the count of dest_port.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=cisco-firewall host="*" action="*" src_ip="*" dest_ip="*" src_port="*" dest_port="*" transport="*" service="*" | iplocation src_ip | stats count values(dest_port) as dest_port by Country
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:08:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302857#M91159</guid>
      <dc:creator>bayman</dc:creator>
      <dc:date>2020-09-29T14:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show the count of a field per country?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302858#M91160</link>
      <description>&lt;P&gt;what about something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; eventtype=cisco-firewall host="*" action="*" src_ip="*" dest_ip="*" src_port="*" dest_port="*" transport="*" service="*" | iplocation src_ip|eventstats count by dest_port Country|eval dest_port_count=dest_port+" - "+count|stats values(dest_port_count) as dest_port_count by Country
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 May 2017 18:03:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302858#M91160</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-05-18T18:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show the count of a field per country?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302859#M91161</link>
      <description>&lt;P&gt;Thanks! Is there a way to sort the count for dest_port_count for this search?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:08:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302859#M91161</guid>
      <dc:creator>bayman</dc:creator>
      <dc:date>2020-09-29T14:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show the count of a field per country?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302860#M91162</link>
      <description>&lt;P&gt;if you put the count before the dest_port in the eval statement, it should sort it ascending. if you want it descending, i might have to do some thinking.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 20:37:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302860#M91162</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-05-18T20:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show the count of a field per country?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302861#M91163</link>
      <description>&lt;P&gt;I'm not sure if I'm understanding..  What I have isn't working but descending would also be nice. It sorts it but by first digit only so (e.g. 1, 2, 33, 42, 5, &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;eventtype=cisco-firewall host="&lt;EM&gt;" action="&lt;/EM&gt;" src_ip="&lt;EM&gt;" dest_ip="&lt;/EM&gt;" src_port="&lt;EM&gt;" dest_port="&lt;/EM&gt;" transport="&lt;EM&gt;" service="&lt;/EM&gt;" | iplocation src_ip|eventstats count by dest_port Country|eval dest_port_count=count+" - "+dest_port|stats values(dest_port_count) as dest_port_count by Country&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:08:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302861#M91163</guid>
      <dc:creator>bayman</dc:creator>
      <dc:date>2020-09-29T14:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to show the count of a field per country?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302862#M91164</link>
      <description>&lt;P&gt;sorry, i should have known it would sort alphanumerically. try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=cisco-firewall host="" action="" src_ip="" dest_ip="" src_port="" dest_port="" transport="" service="" 
| iplocation src_ip 
| eventstats count by dest_port Country 
| eval dest_port_count=count+" - "+dest_port 
| stats values(dest_port_count) as dest_port_count by Country 
| mvexpand dest_port_count 
| sort 0 Country - dest_port_count 
| streamstats count by Country 
| eval count_dest_port_count=count+" : "+dest_port_count 
| stats values(count_dest_port_count) as count_dest_port_count by Country 
| makemv count_dest_port_count 
| eval dest_port_count=mvfilter(match(count_dest_port_count,"-")) 
| fields - count_dest_port_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 May 2017 11:49:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-show-the-count-of-a-field-per-country/m-p/302862#M91164</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-05-19T11:49:51Z</dc:date>
    </item>
  </channel>
</rss>

