<?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 columns that with the highest Total to the left in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/503033#M139979</link>
    <description>&lt;P&gt;Try padding with leading whitespace like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_internal" sourcetype="scheduler" thread_id="AlertNotifier*" NOT (alert_actions="summary_index"OR alert_actions="" ) 
| rex field=savedsearch_id "(.+;.+;(?P&amp;lt;title&amp;gt;.+))" 
| timechart useother=f limit=200 span=1h count by title 

| untable _time search errors 
| eventstats sum(errors) AS TOTAL_ERRORS BY search 
| sort 0 TOTAL_ERRORS 
| streamstats dc(search) AS rank 
| eventstats first(rank) AS rank BY search 
| rename COMMENT AS "Pad with spaces to ensure that the search with the most errors show up leftmost!" 
| eval search = printf("%*s", len(search) + rank, search) 
| fields - rank TOTAL_ERRORS
| addcoltotals labelfield=_time label="Total Sum" 
| xyseries _time search errors 

| addtotals 
| sort _time desc 
| table _time, Total, * 
| where Total != 0 
| rename Total AS "#Alerts/h"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Yes, this means we are doing the totalling twice.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Mar 2020 16:02:16 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2020-03-31T16:02:16Z</dc:date>
    <item>
      <title>sort columns that with the highest Total to the left</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/503031#M139977</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_internal" sourcetype="scheduler" thread_id="AlertNotifier*" NOT (alert_actions="summary_index"OR alert_actions="" ) 
| rex field=savedsearch_id "(.+;.+;(?P&amp;lt;title&amp;gt;.+))" 
| timechart  useother=f limit=200 span=1h count by title
| addcoltotals labelfield=_time label="Total Sum"
| addtotals 
| sort _time desc
| table _time, Total, *
| where Total != 0
| rename Total AS "#Alerts/h"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it should build the table of the triggered alerts with the frequency per hour. Basically it works fine, but I would like to achieve one more thing:&lt;BR /&gt;
- I would like the columns with the highest "Total sum" to be ordered from left to right. The goal is that I can see the alerts being executed the most straight away on the left side of the table.&lt;/P&gt;

&lt;P&gt;How would I achieve this?&lt;/P&gt;

&lt;P&gt;Kind Regards,&lt;BR /&gt;
Kamil&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 15:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/503031#M139977</guid>
      <dc:creator>damucka</dc:creator>
      <dc:date>2020-03-25T15:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: sort columns that with the highest Total to the left</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/503032#M139978</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index="_internal" sourcetype="scheduler" thread_id="AlertNotifier*" NOT (alert_actions="summary_index"OR alert_actions="" ) 
| rex field=savedsearch_id "(.+;.+;(?P&amp;lt;title&amp;gt;.+))" 
| timechart useother=f limit=200 span=1h count by title 
| addcoltotals labelfield=_time 
| table _time * 
| tail 1 
| fields - _* 
| transpose 0 
| sort - "row 1" 
| rename "row 1" as "Total Sum" 
| transpose 0 header_field=column column_name=_time 
| append 
    [ search index="_internal" sourcetype="scheduler" thread_id="AlertNotifier*" NOT (alert_actions="summary_index"OR alert_actions="" ) 
    | rex field=savedsearch_id "(.+;.+;(?P&amp;lt;title&amp;gt;.+))" 
    | timechart useother=f limit=200 span=1h count by title 
    | reverse] 
| reverse 
| addtotals 
| sort _time desc 
| table _time, Total, * 
| where Total != 0 
| rename Total AS "#Alerts/h"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First: make header with appropriate order.&lt;BR /&gt;
Second: append original query results. At that time, reverse the time order.&lt;BR /&gt;
Last: reverse and display them&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 20:26:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/503032#M139978</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-30T20:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: sort columns that with the highest Total to the left</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/503033#M139979</link>
      <description>&lt;P&gt;Try padding with leading whitespace like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_internal" sourcetype="scheduler" thread_id="AlertNotifier*" NOT (alert_actions="summary_index"OR alert_actions="" ) 
| rex field=savedsearch_id "(.+;.+;(?P&amp;lt;title&amp;gt;.+))" 
| timechart useother=f limit=200 span=1h count by title 

| untable _time search errors 
| eventstats sum(errors) AS TOTAL_ERRORS BY search 
| sort 0 TOTAL_ERRORS 
| streamstats dc(search) AS rank 
| eventstats first(rank) AS rank BY search 
| rename COMMENT AS "Pad with spaces to ensure that the search with the most errors show up leftmost!" 
| eval search = printf("%*s", len(search) + rank, search) 
| fields - rank TOTAL_ERRORS
| addcoltotals labelfield=_time label="Total Sum" 
| xyseries _time search errors 

| addtotals 
| sort _time desc 
| table _time, Total, * 
| where Total != 0 
| rename Total AS "#Alerts/h"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Yes, this means we are doing the totalling twice.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 16:02:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/503033#M139979</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-31T16:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: sort columns that with the highest Total to the left</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/542009#M153515</link>
      <description>&lt;P&gt;How would i do the same thing with this search?&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;index="prod_license_summary" | rename indexname as idx | eval GB=MB/1024 | lookup index_list.csv idx OUTPUTNEW idx environment owner&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| table _time idx sourcetypename GB environment owner | where owner="ghprod" AND environment="prod"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| timechart limit=0 span=1d sum(GB) by sourcetypename&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| fillnull value=0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| addcoltotals labelfield=_time label="Total"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| sort Total&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 16:40:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sort-columns-that-with-the-highest-Total-to-the-left/m-p/542009#M153515</guid>
      <dc:creator>adobrzeniecki</dc:creator>
      <dc:date>2021-03-02T16:40:04Z</dc:date>
    </item>
  </channel>
</rss>

