<?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: sort ip's within stats values function in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171353#M49079</link>
    <description>&lt;P&gt;I tried that already it does not work.  here are all the combos that i have tried to sort the values(sr_ip) field....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +dest_port, destip, srcip

..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +dest_port, destip, ip(srcip)

..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +dest_port, destip | sort +ip(srcip)

..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +ip(srcip) | sort +dest_port, destip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;According to the docs for the values() function "The order of the values is lexicographical.”  so if there is anyway to change that order to make it see them as IP&lt;/P&gt;</description>
    <pubDate>Mon, 04 May 2015 19:59:55 GMT</pubDate>
    <dc:creator>tve784</dc:creator>
    <dc:date>2015-05-04T19:59:55Z</dc:date>
    <item>
      <title>sort ip's within stats values function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171347#M49073</link>
      <description>&lt;P&gt;I am trying to figure out a way to sort the source ip's that are in my stats values results.  Just adding a simple sort on that field on the end does nothing.  What im working with is listed below.  Basically this just lists out what destination ip's are talking with what source ip's on specific ports.  Any help would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;... | stats values(src_ip) by dest_port, protocol, dest_ip | sort +dest_port, dest_ip&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:44:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171347#M49073</guid>
      <dc:creator>tve784</dc:creator>
      <dc:date>2020-09-28T19:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: sort ip's within stats values function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171348#M49074</link>
      <description>&lt;P&gt;Hello! How do you know that it is not working? By default your data are sorting in incresing order. Means from the smallest value to the heighest.  By doing &lt;CODE&gt;|sort +dest_port&lt;/CODE&gt; does not change any thing to the results. Test this and let me know how does it works            &lt;CODE&gt;..............|sort -dest_ip&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2015 15:26:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171348#M49074</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-05-04T15:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: sort ip's within stats values function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171349#M49075</link>
      <description>&lt;P&gt;so looking at the values(src_ip) field the ip's are not in order.  it looks like its not reading them as ip's.  the order its showing is like:&lt;/P&gt;

&lt;P&gt;10.123.1.2&lt;BR /&gt;
10.4.5.6&lt;BR /&gt;
10.66.6.7&lt;BR /&gt;
etc...&lt;/P&gt;

&lt;P&gt;the other fields are sorted correctly just not this one field&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2015 15:31:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171349#M49075</guid>
      <dc:creator>tve784</dc:creator>
      <dc:date>2015-05-04T15:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: sort ip's within stats values function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171350#M49076</link>
      <description>&lt;P&gt;it is really surprising! Looking your &lt;STRONG&gt;dest_ip&lt;/STRONG&gt;, here is the order you should have.&lt;/P&gt;

&lt;P&gt;10.4.5.6&lt;BR /&gt;
10.66.6.7&lt;BR /&gt;
10.123.1.2&lt;BR /&gt;
Please Try this and let me know!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   ..... |stats values(src_ip) by dest_port, protocol, dest_ip |eval desip=tostring(ip,"hex")| sort +dest_port, destip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 May 2015 16:54:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171350#M49076</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-05-04T16:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: sort ip's within stats values function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171351#M49077</link>
      <description>&lt;P&gt;its not the dest_ip its the values(src_ip) that is not sorting.  the dest_ip is sorting correctly.  The values(src_ip) can be 1 or many results and this is where they are not sorting if it has more then 1 IP.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:44:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171351#M49077</guid>
      <dc:creator>tve784</dc:creator>
      <dc:date>2020-09-28T19:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: sort ip's within stats values function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171352#M49078</link>
      <description>&lt;P&gt;Please let me know. Where did you sort &lt;STRONG&gt;values(src_ip)&lt;/STRONG&gt; ? Here you go:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +dest_port, destip, srcip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope this may help!&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2015 19:45:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171352#M49078</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-05-04T19:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: sort ip's within stats values function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171353#M49079</link>
      <description>&lt;P&gt;I tried that already it does not work.  here are all the combos that i have tried to sort the values(sr_ip) field....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +dest_port, destip, srcip

..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +dest_port, destip, ip(srcip)

..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +dest_port, destip | sort +ip(srcip)

..... |stats values(src_ip) as srcip by dest_port, protocol, dest_ip | sort +ip(srcip) | sort +dest_port, destip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;According to the docs for the values() function "The order of the values is lexicographical.”  so if there is anyway to change that order to make it see them as IP&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2015 19:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171353#M49079</guid>
      <dc:creator>tve784</dc:creator>
      <dc:date>2015-05-04T19:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: sort ip's within stats values function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171354#M49080</link>
      <description>&lt;P&gt;That is true. The order of the &lt;STRONG&gt;values&lt;/STRONG&gt; is lexicographical when using the &lt;STRONG&gt;values&lt;/STRONG&gt; function. In fact your results are sorting, but not as you want. To sole the problem, instead of use the &lt;STRONG&gt;values&lt;/STRONG&gt; function, i will advise you to use the &lt;STRONG&gt;list&lt;/STRONG&gt; function as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ..... |sort (src_ip)|stats list(src_ip) as sr_cip by dest_port, protocol, dest_ip | sort +dest_port, dest_ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think it will be ok now!&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2015 22:34:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-ip-s-within-stats-values-function/m-p/171354#M49080</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-05-05T22:34:17Z</dc:date>
    </item>
  </channel>
</rss>

