<?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 to monitor logon/logoff time and duration on Windows in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249052#M47931</link>
    <description>&lt;P&gt;I saw both those that are 0 in length and others with longer times being displayed in my search&lt;/P&gt;</description>
    <pubDate>Mon, 17 Apr 2017 15:14:44 GMT</pubDate>
    <dc:creator>kenoski</dc:creator>
    <dc:date>2017-04-17T15:14:44Z</dc:date>
    <item>
      <title>Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249045#M47924</link>
      <description>&lt;P&gt;I was using the following question/answer:&lt;/P&gt;

&lt;P&gt;How can I use windows events to monitor logon sessions&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;/P&gt;

&lt;P&gt;But I need to create a report that lists Logon time, Logoff time, and Duration by User and Computer. Do you know how to alter this search string to achieve this?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 23:53:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249045#M47924</guid>
      <dc:creator>ejwade</dc:creator>
      <dc:date>2016-10-14T23:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249046#M47925</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="WinEventLog:Security" EventCode=4624 OR EventCode=4634  Account_Name=*  action=success 
 | eval User=if(mvcount(Account_Name)&amp;gt;1, mvindex(Account_Name,1), mvindex(Account_Name, 0))  
 | eval User=lower(User)| search NOT User=*$
 | transaction User maxevents=2 startswith="EventCode=4624" endswith="EventCode=4634" maxspan=-1
 | eval Logofftime=Logontime+duration
 | convert ctime(_time) as Logontime
 | convert ctime(Logofftime) as Logofftime
 | eval Duration=round((duration/60), 0) 
 | table Logontime, Logofftime, and Duration User Computer 
 | sort User Computer
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Oct 2016 00:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249046#M47925</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-15T00:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249047#M47926</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
How are you getting logontime field which was used in line 5. This is not working.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Oct 2016 06:16:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249047#M47926</guid>
      <dc:creator>thambisetty_bal</dc:creator>
      <dc:date>2016-10-16T06:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249048#M47927</link>
      <description>&lt;P&gt;I too cannot get this to work for me. It creates a table with the users and Logontimes, but the Logofftime is always blank and duration always equals zero. I've been tinkering with it all day but cannot get it to fully work. It seems so close though!&lt;BR /&gt;
I feel like the way it is defining duration and Logofftime is cyclical and self-referential...&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 19:09:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249048#M47927</guid>
      <dc:creator>caseynordell</dc:creator>
      <dc:date>2017-04-11T19:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249049#M47928</link>
      <description>&lt;P&gt;To be specific, I am needing to tracking logon/logoff times for a specific workstation.  I've installed the Splunk forwarder and configured it to forward the Security log to our index. Here is the code I am using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=MyIndex host="MyMachineName" sourcetype="WinEventLog:Security" EventCode=4624 OR EventCode=4634 Account_Name=*
  | eval User=if(mvcount(Account_Name)&amp;gt;1, mvindex(Account_Name,1), mvindex(Account_Name, 0))  
  | eval User=lower(User)| search NOT (User=*$ OR User=system)
  | transaction User maxevents=2 startswith="EventCode=4624" endswith="EventCode=4634" maxspan=-1
  | eval Logofftime=Logontime+duration
  | convert timeformat="%m/%d/%y %H:%M:%S" ctime(_time) as Logontime
  | convert timeformat="%m/%d/%y %H:%M:%S" ctime(Logofftime) as Logofftime
  | eval Duration=round((duration/60), 0) 
  | table Logontime, Logofftime, and Duration User host 
  | sort User host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And as a result, I'm getting a table which has:&lt;BR /&gt;
Logontime column with a series of logon times&lt;BR /&gt;
Logofftime column which is always blank&lt;BR /&gt;
Duration column which is filled with zeros&lt;BR /&gt;
User column which has a list of users (one for each logontime)&lt;BR /&gt;
host column which has the machine name repeated (this is here because eventually I want to monitor five machines total)&lt;/P&gt;

&lt;P&gt;it seems so close... if I could just get it to fill in the logoff and duration columns, my boss would be so happy. But I can't seem to figure it out any further than this... can anyone provide assistance? Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 20:01:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249049#M47928</guid>
      <dc:creator>caseynordell</dc:creator>
      <dc:date>2017-04-11T20:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249050#M47929</link>
      <description>&lt;P&gt;The search is referencing Logontime before it is being defined.&lt;/P&gt;

&lt;P&gt;This&lt;BR /&gt;
 | eval Logofftime=Logontime+duration&lt;/P&gt;

&lt;P&gt;should be &lt;BR /&gt;
 | eval Logofftime=_time+duration&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 22:40:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249050#M47929</guid>
      <dc:creator>kenoski</dc:creator>
      <dc:date>2017-04-11T22:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249051#M47930</link>
      <description>&lt;P&gt;Thanks. Changing this has filled in the "Logofftime" column, but the logon and logoff times are the same. I think this is because duration still equals zero. Getting closer...&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:03:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249051#M47930</guid>
      <dc:creator>caseynordell</dc:creator>
      <dc:date>2017-04-12T15:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249052#M47931</link>
      <description>&lt;P&gt;I saw both those that are 0 in length and others with longer times being displayed in my search&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 15:14:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249052#M47931</guid>
      <dc:creator>kenoski</dc:creator>
      <dc:date>2017-04-17T15:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249053#M47932</link>
      <description>&lt;P&gt;Hi guys, did anyone get this to display the proper logoff times? I'm running into the same dilemna where the logoff time is the same as the logon time. &lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 12:44:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249053#M47932</guid>
      <dc:creator>dharveynswccd</dc:creator>
      <dc:date>2018-08-09T12:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249054#M47933</link>
      <description>&lt;P&gt;I can only speak for myself: I never got this work satisfactorily 100% of the time.&lt;BR /&gt;
Not only did logoff times sometimes report incorrectly (as the same as logon), but also different people's logins would often overlap and mess up the calculations.&lt;BR /&gt;
In the end, I think we went with another solution besides splunk (I'm not certain because the project was handed off to someone else).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 13:12:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249054#M47933</guid>
      <dc:creator>caseynordell</dc:creator>
      <dc:date>2018-08-09T13:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249055#M47934</link>
      <description>&lt;P&gt;Here is what I did to get it to work properly&lt;BR /&gt;
index=* host=* sourcetype="WinEventLog:Security" EventCode="4624" OR EventCode=4634&lt;BR /&gt;
| transaction user maxevents=2 startswith="EventCode=4624" endswith="EventCode=4634" maxspan=-1&lt;BR /&gt;
| eval Logontime=if(EventCode="4624",_time,null()) &lt;BR /&gt;
| eval Logofftime=Logontime+duration&lt;BR /&gt;
| convert ctime(Logontime) as Logontime&lt;BR /&gt;
| convert ctime(Logofftime) as Logofftime&lt;BR /&gt;
| table host, user, Logontime, Logofftime, duration&lt;BR /&gt;
| sort user, host, -duration&lt;BR /&gt;
| rename duration AS "Duration (seconds)"&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 18:11:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249055#M47934</guid>
      <dc:creator>GoneSplunking</dc:creator>
      <dc:date>2018-10-16T18:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249056#M47935</link>
      <description>&lt;P&gt;@GoneSplunking: Glad to hear this is working for you. However, this doesn't work for me. Still plugging away at this. Thanks though&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 12:40:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249056#M47935</guid>
      <dc:creator>dharvey32</dc:creator>
      <dc:date>2018-10-17T12:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249057#M47936</link>
      <description>&lt;P&gt;I made a slight change for readability on my part. Does any part of the query work?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 17:06:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/249057#M47936</guid>
      <dc:creator>GoneSplunking</dc:creator>
      <dc:date>2018-10-18T17:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Report to monitor logon/logoff time and duration on Windows</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/672774#M112688</link>
      <description>&lt;P&gt;Here is my contribution to this topic, since it now almost 2024.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="wineventlog" source="WinEventLog:Security" (EventCode=4624 AND Logon_Type=2) OR EventCode=4647 Account_Name=* action=success ComputerName=* earliest=-1d@d latest=@d
| eval User=if(mvcount(Account_Name)&amp;gt;1, mvindex(Account_Name,1), mvindex(Account_Name, 0))
| eval User=lower(User)
| search NOT User IN (*$, system)
| transaction User maxevents=2 startswith="EventCode=4624" endswith="EventCode=4647" maxspan=-1
| eval Logontime=if(EventCode="4624",_time,null())
| eval Logofftime=Logontime+duration
| eval Duration=round(duration/60/60, 2)
| convert ctime(Logontime) as Logontime
| convert ctime(Logofftime) as Logofftime
| table User ComputerName Logontime Logofftime Duration EventCode Logon_Type
| sort user, host, -Duration
| rename duration AS "Duration (hours)"&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;For my use case I was looking for interactive sessions or sessions initiated by the user.&amp;nbsp; The log off event is 4647.&amp;nbsp; The previous days events are being collected using the earliest and latest settings.&amp;nbsp; &amp;nbsp;I converted my time to hours with two decimal places.&amp;nbsp; Lastly, I excluded the system account.&lt;BR /&gt;&lt;BR /&gt;Thanks to all those who contributed to the previous solutions they were really helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 17:39:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Report-to-monitor-logon-logoff-time-and-duration-on-Windows/m-p/672774#M112688</guid>
      <dc:creator>jason_hotchkiss</dc:creator>
      <dc:date>2023-12-27T17:39:06Z</dc:date>
    </item>
  </channel>
</rss>

