<?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: Get top 5 field values (by percent) for multiple fields in a single search or report in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58194#M14219</link>
    <description>&lt;P&gt;Ah, I see. Updating my answer.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Sep 2012 19:02:22 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2012-09-12T19:02:22Z</dc:date>
    <item>
      <title>Get top 5 field values (by percent) for multiple fields in a single search or report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58191#M14216</link>
      <description>&lt;P&gt;I have a simple need that I cannot solve.  For a generic search of source=whatever filter1 filter2 filterx | I want to see for N number of fields, the top, say, 5 values, by percentage (not count).&lt;/P&gt;

&lt;P&gt;For example:  Say I am looking at a web storefront and want transaction data. Assuming that all fields are reported 100% of the time, data I am interested in is say, top 5 of the following fields;  creditCardBrand, webBrowser, shipToCity, orderHour, and ipAddress.  For the last 24 hours, source=transactions successful=True orderStatus=Complete shipped=True |&lt;/P&gt;

&lt;P&gt;The results I want need to look something like this:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
&lt;B&gt;Top cCardBrand Percent  webBrowser Percent  shipToCity Percent orderHour Percent&lt;/B&gt;&lt;BR /&gt;
1   Visa       35.00    MSIE       42.00    Austin     10.00   21        13.56&lt;BR /&gt;
2   Mastercard 35.00    Chrome     25.23    Boston     9.85    22        13.01&lt;BR /&gt;
3   Discover   20.00    FireFox    19.50    New York   9.84    18        11.78&lt;BR /&gt;
4   Amex       10.00    Safari     13.00    Miami      5.54    5         10.52&lt;BR /&gt;
5                       Opera      00.27    Denver     3.22    20        4.45&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
NOTE:  All 4 of these fields appear and report these percentages on the right-hand side as selected fields.  I am merely trying to select some of the fields and report back the top 5 values (percentages) of each.  Calculating percents takes a while, so this is fine to be scheduled to run overnight.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2012 17:29:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58191#M14216</guid>
      <dc:creator>jluste</dc:creator>
      <dc:date>2012-09-12T17:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get top 5 field values (by percent) for multiple fields in a single search or report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58192#M14217</link>
      <description>&lt;P&gt;You could run &lt;CODE&gt;top&lt;/CODE&gt; with no limit, then sort by the &lt;CODE&gt;percent&lt;/CODE&gt; field and grab the first N items in the list.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | top 0 creditCardBrand webBrowser shipToCity orderHour ipAddress | sort - percent | head 5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT: OK, I misunderstood your original question. You want to grab the top fields by percentage &lt;EM&gt;separately&lt;/EM&gt;. For this my best advice would be to use &lt;CODE&gt;appendcols&lt;/CODE&gt;. The caveats I can think of is that you will actually need to spawn one search for each field you want to grab the top values by percentage for, and you need to call the percentage fields different names in order to not have them overwrite each other. So something like this should get you going in the right direction:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | top limit=5 percentfield=ccpercent creditCardBrand | appendcols [search ... | top limit=5 percentfield=browserpercent webBrowser] | appendcols [search ... | top limit=5 percentfield=citypercent shipToCity] | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2012 18:26:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58192#M14217</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-09-12T18:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get top 5 field values (by percent) for multiple fields in a single search or report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58193#M14218</link>
      <description>&lt;P&gt;That only gives me one percentage, which is where all of the vales in that row coincide.  Example, 0.249% of my transactions were charged to Visa, ordered on MSIE at 11pm and shipped to Austin.  It doesn't treat each field value as a separate entity.  I need each value's percentage to the search, which means a percentage after every value.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2012 18:44:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58193#M14218</guid>
      <dc:creator>jluste</dc:creator>
      <dc:date>2012-09-12T18:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get top 5 field values (by percent) for multiple fields in a single search or report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58194#M14219</link>
      <description>&lt;P&gt;Ah, I see. Updating my answer.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2012 19:02:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58194#M14219</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-09-12T19:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get top 5 field values (by percent) for multiple fields in a single search or report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58195#M14220</link>
      <description>&lt;P&gt;This worked!  I got the results I was looking for.  Only issue is that some of the placement is wonky.  Example:  the orderHour percentage is 4 columns to the left of orderHour and webBrowser percent comes before webBrowser.&lt;/P&gt;

&lt;P&gt;Is there an easy way to force the order be maintained?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2012 14:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58195#M14220</guid>
      <dc:creator>jluste</dc:creator>
      <dc:date>2012-09-13T14:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get top 5 field values (by percent) for multiple fields in a single search or report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58196#M14221</link>
      <description>&lt;P&gt;You can add &lt;CODE&gt;| table &amp;lt;yourfields&amp;gt;&lt;/CODE&gt; at the end to force a list of fields with the order you want.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2012 17:55:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58196#M14221</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-09-13T17:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get top 5 field values (by percent) for multiple fields in a single search or report</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58197#M14222</link>
      <description>&lt;P&gt;Awesome.  Perfect.  This is a closed 100% completed answer.  Thanks Ayn!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2012 19:10:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-top-5-field-values-by-percent-for-multiple-fields-in-a/m-p/58197#M14222</guid>
      <dc:creator>jluste</dc:creator>
      <dc:date>2012-09-13T19:10:32Z</dc:date>
    </item>
  </channel>
</rss>

