<?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: Calculate average time between events for a series with a unique identifier in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculate-average-time-between-events-for-a-series-with-a-unique/m-p/655608#M226476</link>
    <description>&lt;P&gt;Assuming time_1 is when the image is started and time_n is when the image is complete, then the average image completion time can be calculated like so.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats range(_time) as duration by series_id
| stats avg(duration) as average_image_creation_time&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 25 Aug 2023 09:21:39 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-08-25T09:21:39Z</dc:date>
    <item>
      <title>Calculate average time between events for a series with a unique identifier</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-average-time-between-events-for-a-series-with-a-unique/m-p/655588#M226469</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;We have logs of images created in a series, like below. They are identified by a unique series id, the number of events for each series is variable.&lt;/P&gt;&lt;P&gt;time_1 image_number:1 series_id:99999&lt;BR /&gt;time_2 image_number:2 series_id:99999&lt;BR /&gt;time_3 image_number:3 series_id:99999&lt;BR /&gt;time_n image_number:n series_id:99999&lt;/P&gt;&lt;P&gt;I need to calculate the average time for an image created, i.e. the total time (time_n - time_1)/n for each series. We have thousands of series every day.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips on how I can achieve this?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 07:44:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-average-time-between-events-for-a-series-with-a-unique/m-p/655588#M226469</guid>
      <dc:creator>mikfro</dc:creator>
      <dc:date>2023-08-25T07:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average time between events for a series with a unique identifier</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-average-time-between-events-for-a-series-with-a-unique/m-p/655598#M226472</link>
      <description>&lt;P&gt;Well, you can do this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;your search...
| stats count range(_time) as duration by series_id
| eval avg=duration/count&lt;/LI-CODE&gt;&lt;P&gt;but that will give you a misleading average, as if you have 4 events in your example, created at&lt;/P&gt;&lt;P&gt;1pm, 2pm, 3pm, 4pm&lt;/P&gt;&lt;P&gt;then the range is 3 hours, so the average is 45 minutes, but if the message is written AFTER the image is created, it won't take account of the duration of image 1.&lt;/P&gt;&lt;P&gt;Note: This assumes you have a field called series id extracted from the data.&lt;/P&gt;&lt;P&gt;If not, extract it with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "series_id:(?&amp;lt;series_id&amp;gt;\d+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 25 Aug 2023 08:17:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-average-time-between-events-for-a-series-with-a-unique/m-p/655598#M226472</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-08-25T08:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate average time between events for a series with a unique identifier</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-average-time-between-events-for-a-series-with-a-unique/m-p/655608#M226476</link>
      <description>&lt;P&gt;Assuming time_1 is when the image is started and time_n is when the image is complete, then the average image completion time can be calculated like so.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats range(_time) as duration by series_id
| stats avg(duration) as average_image_creation_time&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 25 Aug 2023 09:21:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-average-time-between-events-for-a-series-with-a-unique/m-p/655608#M226476</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-25T09:21:39Z</dc:date>
    </item>
  </channel>
</rss>

