<?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 specify the order of fields legend in a chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101312#M26180</link>
    <description>&lt;P&gt;If you are graphing something and your legend values are coming out: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alert_120s
alert_15s
alert_180s
alert_300s
alert_600s
alert_60s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and you want the legend values to be in this order: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alert_15s
alert_60s
alert_120s
alert_180s
alert_300s
alert_600s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it's dead simple. Take whatever search was generating the order you didnt want,  and tack on a fields clause to reorder them. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | fields _* * alert_15s alert_60s alert_120s alert_180s alert_300s alert_600s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The FlashChart module just puts up legend items in the order it gets them,  so all you have to do is change the order with &lt;CODE&gt;fields&lt;/CODE&gt; or &lt;CODE&gt;table&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The little wildcard terms are telling splunk to put all the hidden 'underscore' columns first, then any other columns,  and then finally end the sequence with the specified columns.  If you'd rather specify the columns explicitly you can of course do that.  Note that the fields clause seems to damage timechart now,  in that the _time field can get removed if you leave off _* or _time...  &lt;/P&gt;</description>
    <pubDate>Sun, 06 Mar 2011 05:04:55 GMT</pubDate>
    <dc:creator>sideview</dc:creator>
    <dc:date>2011-03-06T05:04:55Z</dc:date>
    <item>
      <title>How to specify the order of fields legend in a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101310#M26178</link>
      <description>&lt;P&gt;I created a search query that returns a set of database alerts which contains a field called alert. The field contains text values such as alert_15s, alert_120s, etc&lt;/P&gt;

&lt;P&gt;I am building a stacked chart which currently display these alerts in this order:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alert_120s
alert_15s
alert_180s
alert_300s
alert_600s
alert_60s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I change the order of the fields/legends to be this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alert_15s
alert_60s
alert_120s
alert_180s
alert_300s
alert_600s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,
Jean&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2010 00:30:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101310#M26178</guid>
      <dc:creator>jdagenais</dc:creator>
      <dc:date>2010-12-09T00:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify the order of fields legend in a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101311#M26179</link>
      <description>&lt;P&gt;This is the solution I have found for these type of problems. &lt;/P&gt;

&lt;P&gt;This provides both a tabular and sorted results by month, day, and alert types.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* sourcetype="sybase_alert" NOT alert="alert_error" NOT alert="alert_network"
| stats 
count(eval(alert="alert_15s")) as a_015,
count(eval(alert="alert_60s")) as a_060,
count(eval(alert="alert_120s")) as a_120,
count(eval(alert="alert_300s")) as a_300,
count(eval(alert="alert_600s")) as a_600,
count(eval(alert="alert_deadlock")) as deadlock,

by date_month, date_mday | sort date_month, date_mday
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Dec 2010 18:10:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101311#M26179</guid>
      <dc:creator>jdagenais</dc:creator>
      <dc:date>2010-12-11T18:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify the order of fields legend in a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101312#M26180</link>
      <description>&lt;P&gt;If you are graphing something and your legend values are coming out: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alert_120s
alert_15s
alert_180s
alert_300s
alert_600s
alert_60s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and you want the legend values to be in this order: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;alert_15s
alert_60s
alert_120s
alert_180s
alert_300s
alert_600s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it's dead simple. Take whatever search was generating the order you didnt want,  and tack on a fields clause to reorder them. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | fields _* * alert_15s alert_60s alert_120s alert_180s alert_300s alert_600s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The FlashChart module just puts up legend items in the order it gets them,  so all you have to do is change the order with &lt;CODE&gt;fields&lt;/CODE&gt; or &lt;CODE&gt;table&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The little wildcard terms are telling splunk to put all the hidden 'underscore' columns first, then any other columns,  and then finally end the sequence with the specified columns.  If you'd rather specify the columns explicitly you can of course do that.  Note that the fields clause seems to damage timechart now,  in that the _time field can get removed if you leave off _* or _time...  &lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2011 05:04:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101312#M26180</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-03-06T05:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify the order of fields legend in a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101313#M26181</link>
      <description>&lt;P&gt;This is all very fine if you know what the fields will be.&lt;BR /&gt;
But what about inverting the order of fields dynamically?&lt;BR /&gt;
"sort" doesn't work.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2013 23:54:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-specify-the-order-of-fields-legend-in-a-chart/m-p/101313#M26181</guid>
      <dc:creator>sansay</dc:creator>
      <dc:date>2013-06-05T23:54:56Z</dc:date>
    </item>
  </channel>
</rss>

