<?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 Column Value in Table from Rex Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545203#M154400</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232861"&gt;@bruceaperez&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you. Please try below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Host "\.(?&amp;lt;host_domain&amp;gt;[^\s]+)"
| sort - host_domain count
| fields - host_domain&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 24 Mar 2021 19:01:28 GMT</pubDate>
    <dc:creator>scelikok</dc:creator>
    <dc:date>2021-03-24T19:01:28Z</dc:date>
    <item>
      <title>Sort Column Value in Table from Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545189#M154392</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to sort a value on a table from a rex field in Splunk Search.&amp;nbsp; For instance, I have below value:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Host&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="292.8px" height="24px"&gt;Wed_Mar_03/12/2021_12:30:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="24px"&gt;mn4.cioprd.lc&lt;/TD&gt;&lt;TD width="49.6px" height="24px"&gt;4295&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="292.8px" height="24px"&gt;Wed_Mar_03/12/2021_12:40:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="24px"&gt;mn3.ciodev.lc&lt;/TD&gt;&lt;TD width="49.6px" height="24px"&gt;2182&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="292.8px" height="24px"&gt;Wed_Mar_03/12/2021_12:30:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="24px"&gt;hive3.CIOPRD.LC&lt;/TD&gt;&lt;TD width="49.6px" height="24px"&gt;1273&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="292.8px" height="24px"&gt;Wed_Mar_03/12/2021_12:30:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="24px"&gt;hive2.cioprd.lc&lt;/TD&gt;&lt;TD width="49.6px" height="24px"&gt;1202&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="292.8px" height="24px"&gt;Wed_Mar_03/12/2021_12:40:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="24px"&gt;mn4.ciodev.lc&lt;/TD&gt;&lt;TD width="49.6px" height="24px"&gt;1118&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to sort this by Host starting with ".cioprd.local".&amp;nbsp; The table should look like this.&lt;/P&gt;&lt;TABLE width="529px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Host&lt;/TD&gt;&lt;TD&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="302.4px" height="38px"&gt;Wed_Mar_03/12/2021_12:30:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="38px"&gt;mn4.cioprd.lc&lt;/TD&gt;&lt;TD width="61.6px" height="38px"&gt;4295&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="302.4px" height="42px"&gt;Wed_Mar_03/12/2021_12:30:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="42px"&gt;hive2.cioprd.lc&lt;/TD&gt;&lt;TD width="61.6px" height="42px"&gt;1202&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="302.4px" height="38px"&gt;Wed_Mar_03/12/2021_12:30:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="38px"&gt;hive3.CIOPRD.LC&lt;/TD&gt;&lt;TD width="61.6px" height="38px"&gt;1273&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="302.4px" height="38px"&gt;Wed_Mar_03/12/2021_12:40:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="38px"&gt;mn3.ciodev.lc&lt;/TD&gt;&lt;TD width="61.6px" height="38px"&gt;2182&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="302.4px" height="36px"&gt;Wed_Mar_03/12/2021_12:40:01_EDT&lt;/TD&gt;&lt;TD width="164px" height="36px"&gt;mn4.ciodev.lc&lt;/TD&gt;&lt;TD width="61.6px" height="36px"&gt;1118&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the using the eval from this &lt;A href="https://www.splunk.com/en_us/blog/tips-and-tricks/order-up-custom-sort-orders.html" target="_self"&gt;doc,&lt;/A&gt; but no luck.&amp;nbsp; Can you please help me on this?&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 17:05:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545189#M154392</guid>
      <dc:creator>bruceaperez</dc:creator>
      <dc:date>2021-03-24T17:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Column Value in Table from Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545196#M154397</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232861"&gt;@bruceaperez&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Your sort by criteria is not certain and I couldn't guess it by looking at your output sample. Do you want to extract one part of host? If yes which part?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 17:48:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545196#M154397</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-03-24T17:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Column Value in Table from Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545198#M154398</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&amp;nbsp;- i want to sort it by host and I want to arrange it by environment.&amp;nbsp;Basically, I want to arrange it first with strings containing "cioprd.lc" then "ciodev.lc".&amp;nbsp; After I have arranged the host on this manner, then I will have to sort the Count in descending order.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 18:04:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545198#M154398</guid>
      <dc:creator>bruceaperez</dc:creator>
      <dc:date>2021-03-24T18:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Column Value in Table from Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545203#M154400</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232861"&gt;@bruceaperez&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you. Please try below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Host "\.(?&amp;lt;host_domain&amp;gt;[^\s]+)"
| sort - host_domain count
| fields - host_domain&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Mar 2021 19:01:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545203#M154400</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-03-24T19:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Column Value in Table from Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545233#M154410</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&amp;nbsp; - it seems it didn't work.&amp;nbsp; Here's my search command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;....&amp;nbsp;| rex field=_raw "(?&amp;lt;Date&amp;gt;[^\|]+)\|(?&amp;lt;Host&amp;gt;[^\|]+)\| (?i)Count=(?&amp;lt;count&amp;gt;[^\|]+)"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| fields + Date, Host, count&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| search "mn4.ciodev.lc" OR "mn3.ciodev.lc" OR "hive3.CIOPRD.LC" OR "hive2.cioprd.lc" OR "mn4.cioprd.lc"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| eval Date = strptime(Date,"%a_%b_%m/%d/%Y_%H:%M:%S_%Z") | sort 0 - Date | eval Date = strftime(Date,"%a_%b_%m/%d/%Y_%H:%M:%S_%Z")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| table Date, Host, count&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;| dedup Host&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 22:41:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545233#M154410</guid>
      <dc:creator>bruceaperez</dc:creator>
      <dc:date>2021-03-24T22:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sort Column Value in Table from Rex Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545254#M154415</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/232861"&gt;@bruceaperez&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I think the problem was uppercase environment. Below changing environment to lowercase should work for you.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=Host "\.(?&amp;lt;host_domain&amp;gt;[^\s]+)" 
| eval host_domain=lower(host_domain) 
| sort - host_domain count
| fields - host_domain&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 25 Mar 2021 04:28:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-Column-Value-in-Table-from-Rex-Field/m-p/545254#M154415</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-03-25T04:28:36Z</dc:date>
    </item>
  </channel>
</rss>

