<?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: Get the chart count by in the form of percentage in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576853#M201032</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235142"&gt;@bijodev1&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;Try this way of using &lt;STRONG&gt;&lt;EM&gt;foreach &lt;/EM&gt;&lt;/STRONG&gt;function for the result table.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=4 
| streamstats count 
| eval http_200 = case(count=1, 2500, count=2, 3904, count=3, 3156, count=4, 40566) 
| eval http_400 = case(count=1, 250, count=2, 32, count=3, 101, count=4, 50) 
| eval http_403 = case(count=1, 22, count=2, 390, count=3, 310, count=4, 400) 
| eval path = case(count=1, "Path_A", count=2, "Path_B",count=3, "Path_C",count=4, "Path_D") 
| fields - count 
| addtotals 
| table path http_200 http_400 http_403 Total 
| foreach http_200 
    [ eval http_200%= tostring(round(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;/Total*100,2))+"%"] 
| foreach http_400 
    [ eval http_400%= tostring(round(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;/Total*100,2))+"%"] 
| foreach http_403 
    [ eval http_403%= tostring(round(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;/Total*100,2))+"%"] 
| table path http_200% http_400% http_403%&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gr0und_Z3r0_0-1638344032492.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17072i58F62A5EC7101461/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Gr0und_Z3r0_0-1638344032492.png" alt="Gr0und_Z3r0_0-1638344032492.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Please do upvote if it helps!&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Dec 2021 07:34:15 GMT</pubDate>
    <dc:creator>Gr0und_Z3r0</dc:creator>
    <dc:date>2021-12-01T07:34:15Z</dc:date>
    <item>
      <title>Get the chart count by in the form of percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576836#M201029</link>
      <description>&lt;P&gt;Hey folks,&lt;/P&gt;&lt;P&gt;I am trying to pull a result based on chart count by, I am also not sure if there is any other command which can fulfil this result.&lt;/P&gt;&lt;P&gt;So the end result what I am looking for is :&lt;BR /&gt;&lt;BR /&gt;http.status IN (200,400,403) | chart count by path http.status&lt;/P&gt;&lt;P&gt;path.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 400&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;403&lt;/P&gt;&lt;P&gt;/abc&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 60%&lt;BR /&gt;/xyz&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 40%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 40%&lt;BR /&gt;/home&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;35%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 35%&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30%&lt;/P&gt;&lt;P&gt;I have checked the community answers but none of them is close to what I am looking for.&lt;/P&gt;&lt;P&gt;if someone could just guide and help me through this, that would be really helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 04:20:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576836#M201029</guid>
      <dc:creator>bijodev1</dc:creator>
      <dc:date>2021-12-01T04:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get the chart count by in the form of percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576853#M201032</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235142"&gt;@bijodev1&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;Try this way of using &lt;STRONG&gt;&lt;EM&gt;foreach &lt;/EM&gt;&lt;/STRONG&gt;function for the result table.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=4 
| streamstats count 
| eval http_200 = case(count=1, 2500, count=2, 3904, count=3, 3156, count=4, 40566) 
| eval http_400 = case(count=1, 250, count=2, 32, count=3, 101, count=4, 50) 
| eval http_403 = case(count=1, 22, count=2, 390, count=3, 310, count=4, 400) 
| eval path = case(count=1, "Path_A", count=2, "Path_B",count=3, "Path_C",count=4, "Path_D") 
| fields - count 
| addtotals 
| table path http_200 http_400 http_403 Total 
| foreach http_200 
    [ eval http_200%= tostring(round(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;/Total*100,2))+"%"] 
| foreach http_400 
    [ eval http_400%= tostring(round(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;/Total*100,2))+"%"] 
| foreach http_403 
    [ eval http_403%= tostring(round(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;/Total*100,2))+"%"] 
| table path http_200% http_400% http_403%&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gr0und_Z3r0_0-1638344032492.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17072i58F62A5EC7101461/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Gr0und_Z3r0_0-1638344032492.png" alt="Gr0und_Z3r0_0-1638344032492.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;Please do upvote if it helps!&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 07:34:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576853#M201032</guid>
      <dc:creator>Gr0und_Z3r0</dc:creator>
      <dc:date>2021-12-01T07:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get the chart count by in the form of percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576859#M201033</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/240999"&gt;@Gr0und_Z3r0&lt;/a&gt;&amp;nbsp; I didn't get this part at all, not sure what is this. I don't have these values at all.&lt;/P&gt;&lt;PRE&gt;| eval http_200 = case(count=1, 2500, count=2, 3904, count=3, 3156, count=4, 40566) 
| eval http_400 = case(count=1, 250, count=2, 32, count=3, 101, count=4, 50) 
| eval http_403 = case(count=1, 22, count=2, 390, count=3, 310, count=4, 400) 
| eval path = case(count=1, "Path_A", count=2, "Path_B",count=3, "Path_C",count=4, "Path_D") &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 09:21:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576859#M201033</guid>
      <dc:creator>bijodev1</dc:creator>
      <dc:date>2021-12-01T09:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get the chart count by in the form of percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576862#M201034</link>
      <description>&lt;P&gt;That part is me creating a test data for my query. &amp;nbsp;You can ignore it. For you it will be the main search that will derive your paths and response codes. Post which you can use the foreach operations to derive the percentage table.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 09:45:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576862#M201034</guid>
      <dc:creator>Gr0und_Z3r0</dc:creator>
      <dc:date>2021-12-01T09:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get the chart count by in the form of percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576863#M201035</link>
      <description>&lt;P&gt;foreach doesn't make sense in this instance as you are only listing one field in each foreach command - replace with this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval http_200%= tostring(round(http_200/Total*100,2))+"%"
| eval http_400%= tostring(round(http_400/Total*100,2))+"%"
| eval http_403%= tostring(round(http_403 /Total*100,2))+"%"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 01 Dec 2021 10:08:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/576863#M201035</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-12-01T10:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get the chart count by in the form of percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/577495#M201248</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt; can you please help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 17:17:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/577495#M201248</guid>
      <dc:creator>bijodev1</dc:creator>
      <dc:date>2021-12-06T17:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get the chart count by in the form of percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/577524#M201263</link>
      <description>&lt;P&gt;Adding to the other great answers here. Here's a simplified/more flexible/dynamic way of doing it:&lt;/P&gt;&lt;P&gt;(base search) http.status IN (200,400,403)&lt;BR /&gt;| eval status="status_".'http.status'&lt;BR /&gt;| chart count by path status&lt;BR /&gt;| addtotals&lt;BR /&gt;| foreach status_* [| eval "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;%"=tostring(round(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;/Total*100,2))+"%"]&lt;BR /&gt;| table path *%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 22:34:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/577524#M201263</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2021-12-06T22:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Get the chart count by in the form of percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/577897#M201380</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/190794"&gt;@johnhuang&lt;/a&gt;&lt;/P&gt;&lt;P&gt;thank you so much. it worked perfectly.&lt;/P&gt;&lt;P&gt;just one thing : wht is this line doing,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;eval status="status_".'http.status'&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 13:53:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-the-chart-count-by-in-the-form-of-percentage/m-p/577897#M201380</guid>
      <dc:creator>bijodev1</dc:creator>
      <dc:date>2021-12-09T13:53:16Z</dc:date>
    </item>
  </channel>
</rss>

