<?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: Need a table format data in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627300#M15111</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248147"&gt;@Vani_26&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;It's a bit hard to say without knowing what the event data looks like.&amp;nbsp; But I imagine it's due to the way you've used the "group by" clause in the index=... query.&amp;nbsp; The group by clause and PREFIX command would only work for the tstats query which also summaries the results into a table output.&lt;BR /&gt;&lt;BR /&gt;The index=... query equivalent to the tstats query would look something like this...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;index=app-clietapp AND (host=ahnbghjk OR host=ncsjnjsnjn) sourcetype=app-clientapp source=/opt/splunk/var/clientapp/application.log "status:"=*&lt;BR /&gt;| stats count BY status: &lt;BR /&gt;| rename status: as App_Status&lt;BR /&gt;| ... and so on ...&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Note - there is no "by" as a word filter in the base search and I'm assuming the fieldname "status:" is auto-extracted and contains a trailing colon.&amp;nbsp; This may need some modification when you look at your event data, i.e. maybe the fieldname is just "status" without the colon.&amp;nbsp; &amp;nbsp;The most important part is that it only works if the status field is extracted some how before the stats command, if that makes sense.&lt;BR /&gt;&lt;BR /&gt;Basically ensure the summarised results (output before the rename command)&amp;nbsp;looks the same.&amp;nbsp; If they don't then the final result will always be different.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2023 02:07:56 GMT</pubDate>
    <dc:creator>yeahnah</dc:creator>
    <dc:date>2023-01-17T02:07:56Z</dc:date>
    <item>
      <title>How to table format data?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627287#M15105</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;My query:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;|tstats count where index=app-clietapp host=ahnbghjk OR host=ncsjnjsnjn sourcetype=app-clientapp source=/opt/splunk/var/clientapp/application.log by PREFIX(status:)
|rename status: as App_Status
|where isnotnull(App_Status)
|eval Sucess=if(App_Status="0" OR App_Status="", "Succ", null())
|eval Error=if(App_Status!="0", "Error", null())&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;output:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="24px"&gt;App_Status&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;
&lt;P&gt;count&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Error&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Sucess&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="24px"&gt;0&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;767890&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Succ&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="24px"&gt;6789&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;65&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;Error&lt;/TD&gt;
&lt;TD width="25%" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But i want the output as shown below:&lt;/P&gt;
&lt;TABLE border="1" width="290.25px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="96.7361px" height="24px"&gt;App_Status&lt;/TD&gt;
&lt;TD width="96.1574px" height="24px"&gt;Error&lt;/TD&gt;
&lt;TD width="96.3542px" height="24px"&gt;Sucess&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="96.7361px" height="24px"&gt;6789&lt;/TD&gt;
&lt;TD width="96.1574px" height="24px"&gt;65&lt;/TD&gt;
&lt;TD width="96.3542px" height="24px"&gt;767890&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please let me know how to modify the query so that i can get the required output.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 20:18:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627287#M15105</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2023-01-17T20:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need a table format data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627291#M15106</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248147"&gt;@Vani_26&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You could try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count where index=app-clietapp host=ahnbghjk OR host=ncsjnjsnjn sourcetype=app-clientapp source=/opt/splunk/var/clientapp/application.log by PREFIX(status:)
| rename status: as App_Status
| where isnotnull(App_Status)
| eval Success=if(App_Status=0, count, Success), Error=if(App_Status!=0, count, Error)
| filldown
| where App_Status &amp;gt; 0
| table App_Status Error Success&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 21:58:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627291#M15106</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-01-16T21:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need a table format data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627296#M15109</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/158935"&gt;@yeahnah&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;let me tell you the original one:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;my orginal query:&lt;/STRONG&gt;&lt;BR /&gt;index=app-clietapp host=ahnbghjk OR host=ncsjnjsnjn sourcetype=app-clientapp source=/opt/splunk/var/clientapp/application.log by PREFIX(status:)&lt;BR /&gt;|rename status: as App_Status&lt;BR /&gt;|where isnotnull(App_Status)&lt;BR /&gt;|eval Sucess=if(App_Status="0" OR App_Status="", "Succ", null())&lt;BR /&gt;|eval Error=if(App_Status!="0", "Error", null())&lt;BR /&gt;|stats count(Sucess) as Sucess_Count count(Error) as Error_Count&amp;nbsp; count(App_Status) as Total_Count&lt;BR /&gt;|eval SuccessPer=( Sucess_Count/Total_Count) * 100&lt;BR /&gt;|eval&amp;nbsp;SuccessPercentage=round(SuccessPer,2)&lt;BR /&gt;|table SuccessPercentage&lt;BR /&gt;&lt;BR /&gt;OUTPUT:&lt;BR /&gt;SuccessPercentage&lt;/P&gt;&lt;P&gt;100.00&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;tstats query:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;|tstats count where index=app-clietapp host=ahnbghjk OR host=ncsjnjsnjn sourcetype=app-clientapp source=/opt/splunk/var/clientapp/application.log by PREFIX(status:)&lt;BR /&gt;|rename status: as App_Status&lt;BR /&gt;|where isnotnull(App_Status)&lt;BR /&gt;|eval Sucess=if(App_Status="0" OR App_Status="", "Succ", null())&lt;BR /&gt;|eval Error=if(App_Status!="0", "Error", null())&lt;BR /&gt;|stats count(Sucess) as Sucess_Count count(Error) as Error_Count&amp;nbsp; count(App_Status) as Total_Count&lt;BR /&gt;|eval SuccessPer=( Sucess_Count/Total_Count) * 100&lt;BR /&gt;|eval&amp;nbsp;SuccessPercentage=round(SuccessPer,2)&lt;BR /&gt;|table SuccessPercentage&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;OUTPUT:&lt;BR /&gt;SuccessPercentage&lt;/P&gt;&lt;P&gt;50.00&lt;BR /&gt;&lt;BR /&gt;When i use orginal query i am gettting output as 100%, but when i use tstats&amp;nbsp; query i am getting 50% as output.&lt;BR /&gt;can you please help on this.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 00:03:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627296#M15109</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2023-01-17T00:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need a table format data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627300#M15111</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248147"&gt;@Vani_26&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;It's a bit hard to say without knowing what the event data looks like.&amp;nbsp; But I imagine it's due to the way you've used the "group by" clause in the index=... query.&amp;nbsp; The group by clause and PREFIX command would only work for the tstats query which also summaries the results into a table output.&lt;BR /&gt;&lt;BR /&gt;The index=... query equivalent to the tstats query would look something like this...&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;index=app-clietapp AND (host=ahnbghjk OR host=ncsjnjsnjn) sourcetype=app-clientapp source=/opt/splunk/var/clientapp/application.log "status:"=*&lt;BR /&gt;| stats count BY status: &lt;BR /&gt;| rename status: as App_Status&lt;BR /&gt;| ... and so on ...&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Note - there is no "by" as a word filter in the base search and I'm assuming the fieldname "status:" is auto-extracted and contains a trailing colon.&amp;nbsp; This may need some modification when you look at your event data, i.e. maybe the fieldname is just "status" without the colon.&amp;nbsp; &amp;nbsp;The most important part is that it only works if the status field is extracted some how before the stats command, if that makes sense.&lt;BR /&gt;&lt;BR /&gt;Basically ensure the summarised results (output before the rename command)&amp;nbsp;looks the same.&amp;nbsp; If they don't then the final result will always be different.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 02:07:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627300#M15111</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-01-17T02:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need a table format data</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627391#M15129</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@yeahnah" target="_blank"&gt;Hi@yeahnah&lt;/A&gt;&lt;BR /&gt;Actually data was coming correctly using tstats byt the issue was with prefix .the data is displaying by prefix.&lt;BR /&gt;now i corrected it by&amp;nbsp; using your suggested query.&lt;BR /&gt;thank you for your help.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;|tstats count where index=app-clietapp host=ahnbghjk OR host=ncsjnjsnjn sourcetype=app-clientapp source=/opt/splunk/var/clientapp/application.log by PREFIX(status:)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|rename status: as App_Status&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|where isnotnull(App_Status)&lt;/SPAN&gt;&lt;BR /&gt;| eval Success=if(App_Status=0, count, Success), Error=if(App_Status!=0, count, Error)&lt;BR /&gt;|filldown&lt;BR /&gt;|stats count by&amp;nbsp;Success, Error&lt;BR /&gt;|eval Total_Count= Success+Error&lt;BR /&gt;|fields Success Error Total_Count&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;|eval SuccessPer=( Success/Total_Count) * 100&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|eval&amp;nbsp;SuccessPercentage=round(SuccessPer,2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;|table SuccessPercentage&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 21:38:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-table-format-data/m-p/627391#M15129</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2023-01-17T21:38:21Z</dc:date>
    </item>
  </channel>
</rss>

