<?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: How to use stats range(_time) and pass the results to timechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-range-time-and-pass-the-results-to-timechart/m-p/356950#M105592</link>
    <description>&lt;P&gt;This works, I was hoping to avoid keeping these times saved and use the range command. Looks like that is not that straight forward. Thanks for the quick response, I was able to get the results I was looking for.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Dec 2017 16:05:18 GMT</pubDate>
    <dc:creator>mkatta</dc:creator>
    <dc:date>2017-12-24T16:05:18Z</dc:date>
    <item>
      <title>How to use stats range(_time) and pass the results to timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-range-time-and-pass-the-results-to-timechart/m-p/356948#M105590</link>
      <description>&lt;P&gt;I have data where every line has a timestamp and a correlationID. I can find the time elapsed for each correlation ID using the following query.&lt;/P&gt;

&lt;P&gt;index=yyy sourcetype=mysource CorrelationID=* | stats range(_time) as timeperCID by CorrelationID, date_hour | stats count avg(timeperCID) as ATC by date_hour | sort num(date_hour)&lt;/P&gt;

&lt;P&gt;I want to use timechart and timewrap on this data to be able to eventually get a week over week comparison of the output. I tried adding a timechart at the end but it does not return any results.&lt;/P&gt;

&lt;P&gt;1) index=yyy sourcetype=mysource CorrelationID=* | stats range(_time) as timeperCID by CorrelationID, date_hour | stats count avg(timeperCID) as ATC by date_hour | sort num(date_hour) | timechart values(ATC)&lt;/P&gt;

&lt;P&gt;2) index=yyy sourcetype=mysource CorrelationID=* | stats range(_time) as timeperCID by CorrelationID, date_hour | timechart count avg(timeperCID) as ATC &lt;/P&gt;

&lt;P&gt;I've also tried to add a _time value or recreate it using the strptime before the timechart with no luck. &lt;/P&gt;

&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:21:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-range-time-and-pass-the-results-to-timechart/m-p/356948#M105590</guid>
      <dc:creator>mkatta</dc:creator>
      <dc:date>2020-09-29T17:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats range(_time) and pass the results to timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-range-time-and-pass-the-results-to-timechart/m-p/356949#M105591</link>
      <description>&lt;P&gt;@mkatta, from code provided in the question seems like you are trying to find the duration of a transaction based on CorrelationID and then plot the average duration of all transactions on the timechart.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=yyy sourcetype=mysource CorrelationID=* 
| stats count as eventCount earliest(_time) as earliestTime latest(_time) as latestTime by CorrelationID
| eval duration=latestTime-earliestTime
| search eventCount&amp;gt;1
| eval _time=earliestTime
| timechart span=1d avg(duration) as avgDuration 
| fillnull value=0 avgDuration
| eval avgDuration=round(avgDuration,1)
| timewrap 1week
| fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Dec 2017 15:33:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-range-time-and-pass-the-results-to-timechart/m-p/356949#M105591</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-24T15:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats range(_time) and pass the results to timechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-range-time-and-pass-the-results-to-timechart/m-p/356950#M105592</link>
      <description>&lt;P&gt;This works, I was hoping to avoid keeping these times saved and use the range command. Looks like that is not that straight forward. Thanks for the quick response, I was able to get the results I was looking for.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Dec 2017 16:05:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-range-time-and-pass-the-results-to-timechart/m-p/356950#M105592</guid>
      <dc:creator>mkatta</dc:creator>
      <dc:date>2017-12-24T16:05:18Z</dc:date>
    </item>
  </channel>
</rss>

