<?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: Why does limit=x on chart command doesn't work? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387640#M113073</link>
    <description>&lt;P&gt;Ayn answered the reason why limit doesn't work on chart.&lt;BR /&gt;
For you to get the desired result you can do the following after your chart command line.&lt;BR /&gt;
| sort 5 views&lt;/P&gt;</description>
    <pubDate>Sun, 12 Jan 2020 03:44:23 GMT</pubDate>
    <dc:creator>surenderjat</dc:creator>
    <dc:date>2020-01-12T03:44:23Z</dc:date>
    <item>
      <title>Why does limit=x on chart command doesn't work?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387637#M113070</link>
      <description>&lt;P&gt;this search string&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    sourcetype=something
    | chart sum(views) as Views over Uploader limit=5
    | sort - Views
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;easily gives you the idea that what you're asking is "give me the top 5 most viewed video of the uploaders". But it doens't work. I fully understand now that you head to use the head command to trim the result to the top 5. But why? Working search string: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    sourcetype=something
    | chart sum(views) as Views over Uploader
    | sort - Views
    | head 5
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jun 2018 01:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387637#M113070</guid>
      <dc:creator>morethanyell</dc:creator>
      <dc:date>2018-06-19T01:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why does limit=x on chart command doesn't work?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387638#M113071</link>
      <description>&lt;P&gt;&lt;CODE&gt;limit&lt;/CODE&gt; is used for limiting how many columns the &lt;CODE&gt;chart&lt;/CODE&gt; command should output when splitting by multiple fields, so if you do &lt;CODE&gt;chart count by field1,field2 limit=5&lt;/CODE&gt;, that means Splunk will limit the &lt;CODE&gt;field2&lt;/CODE&gt; columns to 5. It doesn't take effect when splitting by only one field.&lt;/P&gt;

&lt;P&gt;Also even if the &lt;CODE&gt;limit&lt;/CODE&gt; argument would work like you had expected you would end up with undesired results in your first search. If you grab the first 5 results and THEN sort by Views, you'll likely not end up with the top 5 values as you didn't do the sorting until after you've limited the results.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 06:41:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387638#M113071</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2018-06-19T06:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why does limit=x on chart command doesn't work?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387639#M113072</link>
      <description>&lt;P&gt;The training explained this but for some reason, I did not get it. It just clicked now. Thanks a lot, Ayn!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 06:45:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387639#M113072</guid>
      <dc:creator>morethanyell</dc:creator>
      <dc:date>2018-06-19T06:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Why does limit=x on chart command doesn't work?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387640#M113073</link>
      <description>&lt;P&gt;Ayn answered the reason why limit doesn't work on chart.&lt;BR /&gt;
For you to get the desired result you can do the following after your chart command line.&lt;BR /&gt;
| sort 5 views&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jan 2020 03:44:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-limit-x-on-chart-command-doesn-t-work/m-p/387640#M113073</guid>
      <dc:creator>surenderjat</dc:creator>
      <dc:date>2020-01-12T03:44:23Z</dc:date>
    </item>
  </channel>
</rss>

