<?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: TimeChart Percent Query - Sort on specific field count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606127#M210788</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231200"&gt;@beriwalnishant&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;it's very strang; I never heard a disabled rex command !&lt;/P&gt;&lt;P&gt;Anyway, you can use eval substr:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xyz catcode="*" (prodid="1") (prodcat="*") success="*"
| eval TheError=if(success="false" AND Error like "%%",count,0)
| eval catcode=case(catcode="CCat1","01|CCat1",catcode="BCat2","02|BCat2",catcode="ACat3","03|ACat3")
| timechart span="15m" eval(round(sum(TheError)*100/sum(count),2)) by catcode useother=f
| eval catcode=substr(catcode,3,20)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2022 10:15:53 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-07-19T10:15:53Z</dc:date>
    <item>
      <title>TimeChart Percent Query - How to Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606109#M210779</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;I am stuck with a timechart % query and I want to sort basis a field count and not the default sort on alphabetical order it is counting&lt;BR /&gt;&lt;BR /&gt;There are two queries, it be best if I can get a help or workaround in both the one&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Query - 1&lt;/P&gt;
&lt;P&gt;index=xyz catcode="*" (prodid="1") (prodcat="*") success="*"&lt;BR /&gt;&lt;BR /&gt;| eval TheError=if(success="false" AND Error like "%%",count,0)&lt;BR /&gt;| timechart span="15m" eval(round(sum(TheError)*100/sum(count),2)) by catcode useother=f&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In above query I want to find an option to sort it by catcode and not the default in alphabetical order&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Query 2&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;index= xyz (prodid="1")&amp;nbsp; (prodcat=*) (catcode=*) success=*&lt;/P&gt;
&lt;P&gt;| timechart span=1w sum(count) by catcode limit=10 useother=f usenull=f&lt;/P&gt;
&lt;P&gt;| untable _time catcode count&lt;/P&gt;
&lt;P&gt;| eventstats sum(count) as Total by _time&lt;/P&gt;
&lt;P&gt;| eval Fail_Percent=round(count*100/Total,2)&lt;/P&gt;
&lt;P&gt;| table _time, catcode, Fail_Percent&lt;/P&gt;
&lt;P&gt;| xyseries _time catcode Fail_Percent&lt;/P&gt;
&lt;P&gt;| sort -catcode&lt;BR /&gt;&lt;BR /&gt;In above query all is fine but I dont want 'eventstats count as Total' as it counts all events. I want to have this counted as Total by catcode and then calculate the %&lt;BR /&gt;Can you help please.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;Nishant&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 14:59:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606109#M210779</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2022-07-19T14:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606110#M210780</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231200"&gt;@beriwalnishant&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;no there isn't any parameter to change the sort order in timechart, but you could use a workaround:&lt;/P&gt;&lt;P&gt;e.g. if you have as catCodes ACat3, BCat2 and CCat1 and you want the following order, CCat1, BCat2 and ACat3, you could do something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xyz catcode="*" (prodid="1") (prodcat="*") success="*"
| eval TheError=if(success="false" AND Error like "%%",count,0)
| eval catcode=case(catcode="CCat1","01|CCat1",catcode="BCat2","02|BCat2",catcode="ACat3","03|ACat3")
| timechart span="15m" eval(round(sum(TheError)*100/sum(count),2)) by catcode useother=f
| rex field=catcode "^\d+\|(?&amp;lt;catcode&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 09:20:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606110#M210780</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-07-19T09:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606111#M210781</link>
      <description>&lt;P&gt;Does this give you the totals you want:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eventstats sum(count) as Total by catcode&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Jul 2022 09:24:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606111#M210781</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-19T09:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606121#M210783</link>
      <description>&lt;P&gt;I am afraid but i dont want to collective count using eventstats I want Total count per catcode&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 10:09:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606121#M210783</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2022-07-19T10:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606122#M210784</link>
      <description>&lt;P&gt;Thanks a lot but I am afraid I cant use the rex ... its disabled&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 10:10:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606122#M210784</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2022-07-19T10:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606123#M210785</link>
      <description>&lt;P&gt;Can you check&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;index=xyz catcode="*" (prodid="1") (prodcat="*") success="*"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval TheError=if(success="false" AND catcode="RA",count,0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| timechart span="15m" eval(round(sum(TheError)*100/sum(count),2)) by catcode useother=f&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;This one could be used with multiple codes, it shows correct % for RA but also shows other catcodes as '0' is there a way to hide others that are showing as "0"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 10:11:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606123#M210785</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2022-07-19T10:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606124#M210786</link>
      <description>&lt;P&gt;OK I am confused - you want the total count by catcode? This is what the eventstats by catcode is doing. How are you using it, if it is not giving you what you expect?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 10:14:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606124#M210786</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-19T10:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606127#M210788</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231200"&gt;@beriwalnishant&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;it's very strang; I never heard a disabled rex command !&lt;/P&gt;&lt;P&gt;Anyway, you can use eval substr:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xyz catcode="*" (prodid="1") (prodcat="*") success="*"
| eval TheError=if(success="false" AND Error like "%%",count,0)
| eval catcode=case(catcode="CCat1","01|CCat1",catcode="BCat2","02|BCat2",catcode="ACat3","03|ACat3")
| timechart span="15m" eval(round(sum(TheError)*100/sum(count),2)) by catcode useother=f
| eval catcode=substr(catcode,3,20)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 10:15:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606127#M210788</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-07-19T10:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606135#M210792</link>
      <description>&lt;P&gt;event stats counts all events...meaning if I put catcode=AB with catcode=CD The total will remain the same for all catcodes lets say 100&lt;BR /&gt;&lt;BR /&gt;But I want catcode count as 20 which for catcode=AB only and then if out of 20 catcode=AB has 4 failed as Errors&amp;nbsp; then its 5/20&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 11:12:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606135#M210792</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2022-07-19T11:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606143#M210796</link>
      <description>&lt;P&gt;Please share the SPL that gives you that result&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 11:51:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606143#M210796</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-19T11:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606154#M210802</link>
      <description>&lt;P&gt;yes, here this one is working but now I am unable to find how to keep top 10 only&lt;BR /&gt;&lt;BR /&gt;head or top limit gets no impact on it&lt;BR /&gt;&lt;BR /&gt;index=xyz (catcode="*") (prodid="1") success="*"&lt;BR /&gt;| bucket _time span="15m"&lt;BR /&gt;&lt;BR /&gt;| eval TheError=if(success="false" AND Error="*",count,0)&lt;BR /&gt;| eval Success=if(success="true",count,0)&lt;BR /&gt;| stats sum(Error) as "Failed", sum(Success) as "Passed", sum(count) as Total by _time, catcode&lt;BR /&gt;| eval Failed_Percent=round((Failed/Total)*100,2)&lt;BR /&gt;| fields _time, catcode, Failed_Percent&lt;BR /&gt;| xyseries _time, catcode, Failed_Percent&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now this is working super fine if I mention different catcode like (catcode=AB OR catcode=CD OR catcode=XY)&lt;BR /&gt;&lt;BR /&gt;but the moment I do catcode=*&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;it still works but shows all the catcodes trend lines making the graph messy and congested.....&lt;BR /&gt;&lt;BR /&gt;What is not working here is the top limit or head command&lt;BR /&gt;&lt;BR /&gt;if you can figure that out pls&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 12:20:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606154#M210802</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2022-07-19T12:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606155#M210803</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I found a workable query but a challenge again (describe below) in case you know how to tackle it&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;here this one is working but now I am unable to find how to keep top 10 only&lt;BR /&gt;&lt;BR /&gt;head or top limit gets no impact on it&lt;BR /&gt;&lt;BR /&gt;index=xyz (catcode="*") (prodid="1") success="*"&lt;BR /&gt;| bucket _time span="15m"&lt;BR /&gt;&lt;BR /&gt;| eval TheError=if(success="false" AND Error="*",count,0)&lt;BR /&gt;| eval Success=if(success="true",count,0)&lt;BR /&gt;| stats sum(Error) as "Failed", sum(Success) as "Passed", sum(count) as Total by _time, catcode&lt;BR /&gt;| eval Failed_Percent=round((Failed/Total)*100,2)&lt;BR /&gt;| fields _time, catcode, Failed_Percent&lt;BR /&gt;| xyseries _time, catcode, Failed_Percent&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now this is working super fine if I mention different catcode like (catcode=AB OR catcode=CD OR catcode=XY)&lt;BR /&gt;&lt;BR /&gt;but the moment I do catcode=*&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;it still works but shows all the catcodes trend lines making the graph messy and congested.....&lt;BR /&gt;&lt;BR /&gt;What is not working here is the top limit or head command&lt;BR /&gt;&lt;BR /&gt;if you can figure that out pls&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 12:21:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606155#M210803</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2022-07-19T12:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606158#M210805</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231200"&gt;@beriwalnishant&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the easiest way is to use a larger span in buckets command: e.g. 30 or 60 minutes instaed 15 or you could also sort and use head.&lt;/P&gt;&lt;P&gt;I don't know your full requirements.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 12:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606158#M210805</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-07-19T12:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: TimeChart Percent Query - Sort on specific field count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606169#M210808</link>
      <description>&lt;P&gt;intend to use large only but just for example and testing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;see this graph&amp;nbsp; - large or small .... all catcode are shown....with above query the only struggle is to be able to only limit the number of carriers - rest the query is fine&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="beriwalnishant_0-1658237190121.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20586i16AF56E17545004A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="beriwalnishant_0-1658237190121.png" alt="beriwalnishant_0-1658237190121.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 13:27:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/TimeChart-Percent-Query-How-to-Sort-on-specific-field-count/m-p/606169#M210808</guid>
      <dc:creator>beriwalnishant</dc:creator>
      <dc:date>2022-07-19T13:27:04Z</dc:date>
    </item>
  </channel>
</rss>

