<?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 Finding overall login time for a user in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Finding-overall-login-time-for-a-user/m-p/63100#M15584</link>
    <description>&lt;P&gt;For a game, my logs log two times, a login event and a logoff event. What I want to do is calculate the total online time of a player in splunk. They are two separate events, and I can find them through queries. I'm not sure how to get the total online time of a player (I don't need to break it down into daily events, just the total overall sum of the time they played) &lt;/P&gt;

&lt;P&gt;I think a way to do this would be to sum the timestamps of all of the logon events for a player, then subtract the sum of all the logoff events for the player (My math might be wrong, but I have a feeling this would work) How would I go about doing that?&lt;/P&gt;

&lt;P&gt;I'm very new to splunk, so please go easy on me.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2013 17:19:42 GMT</pubDate>
    <dc:creator>Loscil</dc:creator>
    <dc:date>2013-06-13T17:19:42Z</dc:date>
    <item>
      <title>Finding overall login time for a user</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-overall-login-time-for-a-user/m-p/63100#M15584</link>
      <description>&lt;P&gt;For a game, my logs log two times, a login event and a logoff event. What I want to do is calculate the total online time of a player in splunk. They are two separate events, and I can find them through queries. I'm not sure how to get the total online time of a player (I don't need to break it down into daily events, just the total overall sum of the time they played) &lt;/P&gt;

&lt;P&gt;I think a way to do this would be to sum the timestamps of all of the logon events for a player, then subtract the sum of all the logoff events for the player (My math might be wrong, but I have a feeling this would work) How would I go about doing that?&lt;/P&gt;

&lt;P&gt;I'm very new to splunk, so please go easy on me.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2013 17:19:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-overall-login-time-for-a-user/m-p/63100#M15584</guid>
      <dc:creator>Loscil</dc:creator>
      <dc:date>2013-06-13T17:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Finding overall login time for a user</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-overall-login-time-for-a-user/m-p/63101#M15585</link>
      <description>&lt;P&gt;You may want to look into transactions. Use your "logon" as your startswith attribute, and your "logoff" as your endswith attribute. Transactions will automatically be calculated with a duration field (I believe it's in seconds).&lt;/P&gt;

&lt;P&gt;Once you have that you can simply do a stats sum of the durations by user. Something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt; | transaction &amp;lt;userid_field&amp;gt; startswith="*logon*" endswith="*logoff*" | stats sum(duration) as total_dur by &amp;lt;userid_field&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There are other methods to calculate duration between timstamps that you can find in splunk answers.&lt;/P&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2013 18:15:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-overall-login-time-for-a-user/m-p/63101#M15585</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2013-06-13T18:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Finding overall login time for a user</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Finding-overall-login-time-for-a-user/m-p/63102#M15586</link>
      <description>&lt;P&gt;Worked like a charm, Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2013 18:23:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Finding-overall-login-time-for-a-user/m-p/63102#M15586</guid>
      <dc:creator>Loscil</dc:creator>
      <dc:date>2013-06-13T18:23:04Z</dc:date>
    </item>
  </channel>
</rss>

