<?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 Turns stats into timechart with avg in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Turns-stats-into-timechart-with-avg/m-p/690994#M235329</link>
    <description>&lt;P&gt;I asked in a previous thread for help to get response time based on time differential between two events connected by a UUID (&lt;A href="https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690628#M235207" target="_blank" rel="noopener"&gt;Solved: Re: Measuring time difference between 2 entries - Splunk Community&lt;/A&gt;) which is working perfectly.&lt;/P&gt;
&lt;P&gt;I turned that into an average response time grouped by a particular transaction type (processName) and thats working fine as well, but I would very much like to use this as a timechart - but I can't seem to get it working.&lt;/P&gt;
&lt;P&gt;From what I understand, the fact that I am using Stats stripts out the _time which the timechart uses, but I am not sure how to work around that.&lt;BR /&gt;&lt;BR /&gt;My query goes as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[My search here]
| stats
earliest(eval(if(eventType="BEGIN",_time,""))) AS Begin_time
latest(eval(if(eventType="END",_time,""))) AS End_time
BY UUID processName
| eval ResponseTime=End_time-Begin_time
| stats avg(ResponseTime) by processName&lt;/LI-CODE&gt;
&lt;P&gt;I've tried a number of things that didn't work, including changing stats to:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| timechart span=10m Avg(ResponseTime) by processName&lt;/LI-CODE&gt;
&lt;P&gt;While this did perform a search, it generated no result whatsoever. Won't bore everyone with my multiple failures.&lt;/P&gt;
&lt;P&gt;My query gives me basically&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;ProcessName&lt;/TD&gt;
&lt;TD width="50%"&gt;Avg(Response_time)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Process1&lt;/TD&gt;
&lt;TD width="50%"&gt;0.5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Process2&lt;/TD&gt;
&lt;TD width="50%"&gt;0.6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Process3&lt;/TD&gt;
&lt;TD width="50%"&gt;0.7&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My goal is to get this as a time chart visualization with a span of 10 mins.&lt;/P&gt;
&lt;P&gt;Any suggestions ?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2024 14:03:58 GMT</pubDate>
    <dc:creator>Silah</dc:creator>
    <dc:date>2024-06-18T14:03:58Z</dc:date>
    <item>
      <title>Turns stats into timechart with avg</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turns-stats-into-timechart-with-avg/m-p/690994#M235329</link>
      <description>&lt;P&gt;I asked in a previous thread for help to get response time based on time differential between two events connected by a UUID (&lt;A href="https://community.splunk.com/t5/Splunk-Search/Measuring-time-difference-between-2-entries/m-p/690628#M235207" target="_blank" rel="noopener"&gt;Solved: Re: Measuring time difference between 2 entries - Splunk Community&lt;/A&gt;) which is working perfectly.&lt;/P&gt;
&lt;P&gt;I turned that into an average response time grouped by a particular transaction type (processName) and thats working fine as well, but I would very much like to use this as a timechart - but I can't seem to get it working.&lt;/P&gt;
&lt;P&gt;From what I understand, the fact that I am using Stats stripts out the _time which the timechart uses, but I am not sure how to work around that.&lt;BR /&gt;&lt;BR /&gt;My query goes as follows:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[My search here]
| stats
earliest(eval(if(eventType="BEGIN",_time,""))) AS Begin_time
latest(eval(if(eventType="END",_time,""))) AS End_time
BY UUID processName
| eval ResponseTime=End_time-Begin_time
| stats avg(ResponseTime) by processName&lt;/LI-CODE&gt;
&lt;P&gt;I've tried a number of things that didn't work, including changing stats to:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| timechart span=10m Avg(ResponseTime) by processName&lt;/LI-CODE&gt;
&lt;P&gt;While this did perform a search, it generated no result whatsoever. Won't bore everyone with my multiple failures.&lt;/P&gt;
&lt;P&gt;My query gives me basically&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;ProcessName&lt;/TD&gt;
&lt;TD width="50%"&gt;Avg(Response_time)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Process1&lt;/TD&gt;
&lt;TD width="50%"&gt;0.5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Process2&lt;/TD&gt;
&lt;TD width="50%"&gt;0.6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Process3&lt;/TD&gt;
&lt;TD width="50%"&gt;0.7&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My goal is to get this as a time chart visualization with a span of 10 mins.&lt;/P&gt;
&lt;P&gt;Any suggestions ?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 14:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turns-stats-into-timechart-with-avg/m-p/690994#M235329</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-06-18T14:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Turns stats into timechart with avg</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turns-stats-into-timechart-with-avg/m-p/690999#M235333</link>
      <description>&lt;P&gt;That is because timechart command requires to have the _time field, and you are removing it with the first stats command.&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[My search here]
| stats
earliest(eval(if(eventType="BEGIN",_time,""))) AS Begin_time
latest(eval(if(eventType="END",_time,""))) AS End_time
BY UUID processName
| eval ResponseTime=End_time-Begin_time
| eval _time = Begin_time
| timechart span=10m avg(ResponseTime) by processName&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 18 Jun 2024 14:11:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turns-stats-into-timechart-with-avg/m-p/690999#M235333</guid>
      <dc:creator>glc_slash_it</dc:creator>
      <dc:date>2024-06-18T14:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Turns stats into timechart with avg</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Turns-stats-into-timechart-with-avg/m-p/691002#M235334</link>
      <description>&lt;P&gt;Beautiful. Thank you, this worked and now I understand how to pass the time in when it gets stripped out earlier.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 14:14:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Turns-stats-into-timechart-with-avg/m-p/691002#M235334</guid>
      <dc:creator>Silah</dc:creator>
      <dc:date>2024-06-18T14:14:33Z</dc:date>
    </item>
  </channel>
</rss>

