<?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: Split Timechart into stats by field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568799#M198232</link>
    <description>&lt;P&gt;OK, sorry, I "mislooked" at my data. You're right, if you don't specify any fields, the stats do a set of predefined stats functions on any column.&lt;/P&gt;&lt;P&gt;And I understand that you want to generate a set of stats over every actor separetely?&lt;/P&gt;&lt;P&gt;How about&lt;/P&gt;&lt;PRE&gt;hostalias=$hostname$ AND actor AND total&lt;BR /&gt;| timechart span=1s count by actor&lt;BR /&gt;| untable _time actor value&lt;BR /&gt;| stats by actor&lt;/PRE&gt;&lt;P&gt;Or whatever stats aggregations you want to use.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Sep 2021 16:45:50 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2021-09-28T16:45:50Z</dc:date>
    <item>
      <title>Split Timechart into stats by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568455#M198107</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have the query :&lt;/P&gt;&lt;P&gt;hostalias=$hostname$ AND actor AND total | timechart span=1s count by actor | stats&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This returns the stats for all the actors into a row, but I wanted to have a table where each row indicates a specific actor and the resulting max/avg/p50/p99 statistics for that actor.&lt;/P&gt;&lt;P&gt;Something like below:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;Actor&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;max&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;avg&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;p50&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;p99&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;actorName1&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;actorName2&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;actorName3&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%" height="25px"&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the following query, but nothing returned:&lt;/P&gt;&lt;P&gt;hostalias=$hostname$ AND actor AND total | timechart span=1s count as TPS | stats&lt;/P&gt;&lt;P&gt;max(TPS) as maxTPS avg(TPS) as avgTPS p50(TPS) as p50TPS p99(TPS) as p99TPS by actor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had something similar working before, but there was no timechart involved. Is this possible to do with timechart?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any insights&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 00:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568455#M198107</guid>
      <dc:creator>mfudali</dc:creator>
      <dc:date>2021-09-25T00:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Split Timechart into stats by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568458#M198108</link>
      <description>&lt;P&gt;Do you want to have those stats separately per each second? That's easy - just add other stats functions after "count" in your timechart&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you want the stats for the whole period? Do a separate search.&lt;/P&gt;&lt;P&gt;You're trying to transform the original data (do a timechart) but then reach to the original events again. It doesn't work that way. In general, after each pipe character you "lose" information of what happened before that pipe.&lt;/P&gt;&lt;P&gt;So if you do an aggregation by using stats or timechart, you can no longer perform aggregations on raw data. In some cases (like counting events) you can simply add up stats values and it gives you sane results but if you aggregated events and returned just number of events you cannot count percentiles on the original data.&lt;/P&gt;&lt;P&gt;So the question is - what exactly do you want to calculate?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 05:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568458#M198108</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-25T05:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Split Timechart into stats by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568776#M198218</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for replying. So I wanted to query a box for logs that contain the 'actor' and 'total' fields, then I wanted to count how many of those logs are happening each second per 'actor' and I wanted to get the stats per 'actor' as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I queried,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;hostalias=$hostname$ AND actor AND total | timechart span=1s count by actor | stats&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This was the result:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mfudali_0-1632843075261.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16189iB23B27B1599487A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mfudali_0-1632843075261.png" alt="mfudali_0-1632843075261.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Which is great but now when I want to extract the relevant information from stats (such as max, avg, p50, p99), I can no longer split the data up 'by actor'.&lt;/P&gt;&lt;P&gt;I would like the result to look more like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mfudali_1-1632843223311.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16190iE2814F07A34DB07A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mfudali_1-1632843223311.png" alt="mfudali_1-1632843223311.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Which was create by this query:&amp;nbsp;hostalias=$hostname$ AND actor | stats&lt;BR /&gt;max(total) as maxT avg(total) as avgT p50(total) as p50T p99(total) as p99T by actor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I need to store the actor field because I lose that information after piping the results of the timechart to the stats function, but I'm not sure how to do that either. Thanks again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:37:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568776#M198218</guid>
      <dc:creator>mfudali</dc:creator>
      <dc:date>2021-09-28T15:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Split Timechart into stats by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568782#M198221</link>
      <description>&lt;P&gt;Well, firstly, doing a timechart and then _counting_ the resulting values seems a bit pointless, don't you think? You're not counting your data. You're counting the time...&lt;/P&gt;&lt;P&gt;Can't you drop the final stats from the first search and just do your stats by actor?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568782#M198221</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T15:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Split Timechart into stats by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568784#M198222</link>
      <description>&lt;P&gt;Essentially this is counting the transactions per second, here's an output of the timechart:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mfudali_0-1632844349306.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16191i6960D65212A2F799/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mfudali_0-1632844349306.png" alt="mfudali_0-1632844349306.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see that there are multiple transactions for an actor in a given second.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:53:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568784#M198222</guid>
      <dc:creator>mfudali</dc:creator>
      <dc:date>2021-09-28T15:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Split Timechart into stats by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568787#M198224</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;hostalias=$hostname$ AND actor AND total 
| bucket span=1s _time | stats count as TPS by _time actor
| stats max(TPS) as maxTPS avg(TPS) as avgTPS p50(TPS) as p50TPS p99(TPS) as p99TPS by actor&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Sep 2021 15:57:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568787#M198224</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2021-09-28T15:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Split Timechart into stats by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568799#M198232</link>
      <description>&lt;P&gt;OK, sorry, I "mislooked" at my data. You're right, if you don't specify any fields, the stats do a set of predefined stats functions on any column.&lt;/P&gt;&lt;P&gt;And I understand that you want to generate a set of stats over every actor separetely?&lt;/P&gt;&lt;P&gt;How about&lt;/P&gt;&lt;PRE&gt;hostalias=$hostname$ AND actor AND total&lt;BR /&gt;| timechart span=1s count by actor&lt;BR /&gt;| untable _time actor value&lt;BR /&gt;| stats by actor&lt;/PRE&gt;&lt;P&gt;Or whatever stats aggregations you want to use.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 16:45:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568799#M198232</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-28T16:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Split Timechart into stats by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568811#M198240</link>
      <description>&lt;P&gt;Perfect! Thank you so much&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2021 17:25:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-Timechart-into-stats-by-field/m-p/568811#M198240</guid>
      <dc:creator>mfudali</dc:creator>
      <dc:date>2021-09-28T17:25:29Z</dc:date>
    </item>
  </channel>
</rss>

