<?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 Average Time over two Timestamps in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91135#M18930</link>
    <description>&lt;P&gt;I am trying to get the average Session duration by USER_ID, but a single USER_ID can have multiple SESSION_ID.  The SESSION_ID is the unique identifier.   I currently have a table that looks like this:&lt;/P&gt;

&lt;P&gt;USER_ID------SESSION_ID -----------------------            start      ---------------------------           stop&lt;BR /&gt;&lt;BR /&gt;
UserA ------{firstSessionID} ----------    20130710 08:15:53   --------  20130710 08:16:15&lt;BR /&gt;&lt;BR /&gt;
UserB-----{secondSessionID} -----   20130710 08:16:42   --------  20130710 08:16:55&lt;BR /&gt;&lt;BR /&gt;
UserA------{ThirdSessionID} ------- 20130709 13:34:23 -------- 20130709 13:35:34&lt;/P&gt;

&lt;P&gt;I am trying to eventually have a list of all the USER_ID and the average Session duration by USER_ID.  My search for the above result looks like this:  &lt;/P&gt;

&lt;P&gt;index=loghistory SESSION_ID=* USER_ID=* DEALER_ID=* USER_ID!="N/A" |stats earliest(EVENT_TIMESTAMP) as start, latest(EVENT_TIMESTAMP) as stop by USER_ID,SESSION_ID&lt;/P&gt;

&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:18:30 GMT</pubDate>
    <dc:creator>JoeSco27</dc:creator>
    <dc:date>2020-09-28T14:18:30Z</dc:date>
    <item>
      <title>Average Time over two Timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91135#M18930</link>
      <description>&lt;P&gt;I am trying to get the average Session duration by USER_ID, but a single USER_ID can have multiple SESSION_ID.  The SESSION_ID is the unique identifier.   I currently have a table that looks like this:&lt;/P&gt;

&lt;P&gt;USER_ID------SESSION_ID -----------------------            start      ---------------------------           stop&lt;BR /&gt;&lt;BR /&gt;
UserA ------{firstSessionID} ----------    20130710 08:15:53   --------  20130710 08:16:15&lt;BR /&gt;&lt;BR /&gt;
UserB-----{secondSessionID} -----   20130710 08:16:42   --------  20130710 08:16:55&lt;BR /&gt;&lt;BR /&gt;
UserA------{ThirdSessionID} ------- 20130709 13:34:23 -------- 20130709 13:35:34&lt;/P&gt;

&lt;P&gt;I am trying to eventually have a list of all the USER_ID and the average Session duration by USER_ID.  My search for the above result looks like this:  &lt;/P&gt;

&lt;P&gt;index=loghistory SESSION_ID=* USER_ID=* DEALER_ID=* USER_ID!="N/A" |stats earliest(EVENT_TIMESTAMP) as start, latest(EVENT_TIMESTAMP) as stop by USER_ID,SESSION_ID&lt;/P&gt;

&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:18:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91135#M18930</guid>
      <dc:creator>JoeSco27</dc:creator>
      <dc:date>2020-09-28T14:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Average Time over two Timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91136#M18931</link>
      <description>&lt;P&gt;use the Transaction command.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2013 14:41:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91136#M18931</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2013-07-10T14:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Average Time over two Timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91137#M18932</link>
      <description>&lt;P&gt;Try something like this.&lt;BR /&gt;
Converting times to epoch times , then doing the math on the epoch value :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval startSession=strptime(start,"%Y%m%d %H:%M:%S") | eval endSession=strptime(stop,"%Y%m%d %H:%M:%S") | eval sessionDuration=endSession-startSession | stats avg(sessionDuration) by USER_ID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2013 14:56:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91137#M18932</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-07-10T14:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Average Time over two Timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91138#M18933</link>
      <description>&lt;P&gt;This works, thank you.  The time that returns is in seconds because it was converted to epoch, correct?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2013 16:33:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91138#M18933</guid>
      <dc:creator>JoeSco27</dc:creator>
      <dc:date>2013-07-10T16:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Average Time over two Timestamps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91139#M18934</link>
      <description>&lt;P&gt;Yes , seconds. You can use "strftime" to convert it back into another format.&lt;/P&gt;

&lt;P&gt;Don't forget to accept the answer if it worked.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2013 16:36:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Average-Time-over-two-Timestamps/m-p/91139#M18934</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-07-10T16:36:44Z</dc:date>
    </item>
  </channel>
</rss>

