<?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: Report for showing users logon / logoff and the duration in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338069#M9526</link>
    <description>&lt;P&gt;hello there,&lt;/P&gt;

&lt;P&gt;some great answers and queries from this portal:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/511064/how-do-i-chart-windows-logon-and-logoff-per-user-b.html"&gt;https://answers.splunk.com/answers/511064/how-do-i-chart-windows-logon-and-logoff-per-user-b.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/462736/report-to-monitor-logonlogoff-time-and-duration-on.html"&gt;https://answers.splunk.com/answers/462736/report-to-monitor-logonlogoff-time-and-duration-on.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/127012/how-can-i-use-windows-events-to-monitor-logon-sessions.html"&gt;https://answers.splunk.com/answers/127012/how-can-i-use-windows-events-to-monitor-logon-sessions.html&lt;/A&gt;&lt;BR /&gt;
here is an asnwer that explains well the logon logoff on the AD and DC and how it defers from collecting it at the server / desktop. scroll down a little to the answer by @southeringtonp&lt;BR /&gt;
 &lt;A href="https://answers.splunk.com/answers/101366/collecting-logon-logoff-logs-from-active-directory-and-put-them-into-splunk.html"&gt;https://answers.splunk.com/answers/101366/collecting-logon-logoff-logs-from-active-directory-and-put-them-into-splunk.html&lt;/A&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2017 21:35:59 GMT</pubDate>
    <dc:creator>adonio</dc:creator>
    <dc:date>2017-12-12T21:35:59Z</dc:date>
    <item>
      <title>Report for showing users logon / logoff and the duration</title>
      <link>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338068#M9525</link>
      <description>&lt;P&gt;I've seen several threads, but nothing to really dial in what we're needing for reporting.  Figured I would see if anyone else had input on this while I keep waiting on my ticket to be answered.&lt;/P&gt;

&lt;P&gt;This is the search query I've managed to piece together.&lt;/P&gt;

&lt;P&gt;sourcetype="WinEventLog:Security" EventCode=4624 OR EventCode=4634 Account_Name=*&lt;BR /&gt;
   | search NOT (Account_Name=&lt;EM&gt;$ OR Account_Name=SYSTEM OR Account_Name=ANONYMOUS&lt;/EM&gt;)&lt;BR /&gt;
   | eval User=if(mvcount(Account_Name)&amp;gt;1, mvindex(Account_Name,1), mvindex(Account_Name, 0))&lt;BR /&gt;&lt;BR /&gt;
   | eval User=lower(User)&lt;BR /&gt;
   | search NOT (User=*$ OR User=system)&lt;BR /&gt;
   | transaction User maxevents=2 startswith="EventCode=4624" endswith="EventCode=4634" maxspan=-1&lt;BR /&gt;
   | eval Logofftime=_time+duration&lt;BR /&gt;
   | convert timeformat="%m/%d/%y %H:%M:%S" ctime(_time) as Logontime&lt;BR /&gt;
   | convert timeformat="%m/%d/%y %H:%M:%S" ctime(Logofftime) as Logofftime&lt;BR /&gt;
   | eval h=floor(duration/3600) | eval m=floor((duration-(h*3600))/60) | eval s=floor(duration-(h*3600)-(m*60)) | eval SessionDuration=h."h ".m."m ".s."s"&lt;BR /&gt;
   | table Logontime, Logofftime, SessionDuration, User, host &lt;BR /&gt;
   | sort User host&lt;/P&gt;

&lt;P&gt;This query gives an output like this....&lt;/P&gt;

&lt;P&gt;Logontime   Logofftime  SessionDuration User    host&lt;BR /&gt;
12/11/17 23:32:29   12/11/17 23:32:29   0h 0m 0s    john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 21:46:30   12/11/17 21:46:30   0h 0m 0s    john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 21:46:29   12/11/17 21:47:00   0h 0m 31s   john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 21:46:29   12/11/17 21:56:41   0h 10m 12s  john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 20:43:03   12/11/17 20:43:14   0h 0m 11s   john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 20:12:34   12/11/17 20:13:05   0h 0m 31s   john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 20:00:29   12/11/17 20:00:29   0h 0m 0s    john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 20:00:29   12/11/17 20:01:00   0h 0m 31s   john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 18:14:29   12/11/17 18:14:29   0h 0m 0s    john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 18:14:28   12/11/17 18:24:40   0h 10m 12s  john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 16:43:03   12/11/17 16:43:18   0h 0m 15s   john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 16:28:29   12/11/17 16:28:29   0h 0m 0s    john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 16:28:29   12/11/17 16:29:01   0h 0m 32s   john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 16:28:28   12/11/17 16:38:41   0h 10m 13s  john.doe    PrimaryDC&lt;BR /&gt;
12/11/17 16:12:34   12/11/17 16:13:06   0h 0m 32s   john.doe    PrimaryDC&lt;/P&gt;

&lt;P&gt;...&lt;/P&gt;

&lt;P&gt;I'm trying to build a report to show user' logon and logoff times along with duration they were logged on and from source computer.&lt;/P&gt;

&lt;P&gt;But it gives me random times and only seems to pull information about the PrimaryDC.&lt;/P&gt;

&lt;P&gt;Anyone have any ideas to try and make this work?  Thanks...&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:13:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338068#M9525</guid>
      <dc:creator>rchristian</dc:creator>
      <dc:date>2020-09-29T17:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: Report for showing users logon / logoff and the duration</title>
      <link>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338069#M9526</link>
      <description>&lt;P&gt;hello there,&lt;/P&gt;

&lt;P&gt;some great answers and queries from this portal:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/511064/how-do-i-chart-windows-logon-and-logoff-per-user-b.html"&gt;https://answers.splunk.com/answers/511064/how-do-i-chart-windows-logon-and-logoff-per-user-b.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/462736/report-to-monitor-logonlogoff-time-and-duration-on.html"&gt;https://answers.splunk.com/answers/462736/report-to-monitor-logonlogoff-time-and-duration-on.html&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/127012/how-can-i-use-windows-events-to-monitor-logon-sessions.html"&gt;https://answers.splunk.com/answers/127012/how-can-i-use-windows-events-to-monitor-logon-sessions.html&lt;/A&gt;&lt;BR /&gt;
here is an asnwer that explains well the logon logoff on the AD and DC and how it defers from collecting it at the server / desktop. scroll down a little to the answer by @southeringtonp&lt;BR /&gt;
 &lt;A href="https://answers.splunk.com/answers/101366/collecting-logon-logoff-logs-from-active-directory-and-put-them-into-splunk.html"&gt;https://answers.splunk.com/answers/101366/collecting-logon-logoff-logs-from-active-directory-and-put-them-into-splunk.html&lt;/A&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 21:35:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338069#M9526</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-12-12T21:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Report for showing users logon / logoff and the duration</title>
      <link>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338070#M9527</link>
      <description>&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/462736/report-to-monitor-logonlogoff-time-and-duration-on.html"&gt;https://answers.splunk.com/answers/462736/report-to-monitor-logonlogoff-time-and-duration-on.html&lt;/A&gt;&lt;BR /&gt;
^^- this link helped me the most to begin with (as you can see from my search query).  But as I posted the output is far from being what is wanted.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 22:08:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338070#M9527</guid>
      <dc:creator>rchristian</dc:creator>
      <dc:date>2017-12-12T22:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Report for showing users logon / logoff and the duration</title>
      <link>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338071#M9528</link>
      <description>&lt;P&gt;This is quite a rabbit hole.  My impression from your question is that you're looking for some kind of user activity/attendance tracking? You're not going to have any kind of fidelity to your results because the DC captures authentication traffic, not user activity/session tracking.  For example - You'll get authentication events all night if a user locks their system instead of logs off.  Network logons are logged for all kinds of activity, so you'll probably see dozens - even hundreds - of logon type 3 events throughout the day for each user.&lt;/P&gt;

&lt;P&gt;The only log you might be able to build somewhat reliable session information from is on the systems that the users log on to directly - it's WinEventLog://Microsoft-Windows-TerminalServices-LocalSessionManager/Operational  but you'll need to collect it from all endpoints.  Even with this you'll have some considerations, like if the user is remote &amp;amp; accessing the network via VPN, if you're trying to account for BYOD, etc.&lt;/P&gt;

&lt;P&gt;If you want to look at per-user authentication traffic strictly in the domain controller logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=ops sourcetype=WinEventLog:Security (EventCode=4624 OR EventCode=4634) user!="anonymous logon" user!=SYSTEM user!=*$  | streamstats earliest(_time) AS login, latest(_time) AS logout by user | eval session_duration=logout-login |  eval h=floor(session_duration/3600) | eval m=floor((session_duration-(h*3600))/60) | eval s=floor(session_duration-(h*3600)-(m*60)) | eval SessionDuration=h."h ".m."m ".s."s" | convert timeformat=" %m/%d/%y %H:%M:%S" ctime(login) AS login | convert timeformat=" %m/%d/%y %H:%M:%S" ctime(logout) AS logout | stats count AS auth_event_count, max(SessionDuration) AS session_duration, earliest(login) as login, latest(logout) as logout, values(Logon_Type) AS logon_types by user | where auth_event_count&amp;gt;1 | sort user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using the transaction command is really expensive, and I would completely avoid it for something like the authentication log.&lt;/P&gt;

&lt;P&gt;Please look at the data behind the curtain - unless I've misunderstood your question there's a great chance it's not going to provide what you're looking for.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 22:20:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338071#M9528</guid>
      <dc:creator>wenthold</dc:creator>
      <dc:date>2017-12-12T22:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Report for showing users logon / logoff and the duration</title>
      <link>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338072#M9529</link>
      <description>&lt;P&gt;To simplify this.  Want we are looking for in this report is&lt;/P&gt;

&lt;P&gt;Logontime == Logofftime == SessionDuration == User == host (computer use is logging in from)&lt;BR /&gt;
12/11/17 23:32:29 == 12/11/17 23:32:29  == 0h 0m 0s == john.doe == computername&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 23:16:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338072#M9529</guid>
      <dc:creator>rchristian</dc:creator>
      <dc:date>2017-12-15T23:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Report for showing users logon / logoff and the duration</title>
      <link>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338073#M9530</link>
      <description>&lt;P&gt;@wenthold - This is a great output. How can I amend the search to break it down by day. For example, if I want to view activity for a single user over a span of Jan1 - Feb22? Currently, when I search this date range, it provides one metric of 99+ hours of session duration. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 16:49:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/Report-for-showing-users-logon-logoff-and-the-duration/m-p/338073#M9530</guid>
      <dc:creator>Jarougeau</dc:creator>
      <dc:date>2020-02-28T16:49:41Z</dc:date>
    </item>
  </channel>
</rss>

