<?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: Logon Duration in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534868#M4627</link>
    <description>You could try eval/fieldformat duration = tostring(duration, “duration”)</description>
    <pubDate>Tue, 05 Jan 2021 23:13:44 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2021-01-05T23:13:44Z</dc:date>
    <item>
      <title>Logon Duration</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534862#M4623</link>
      <description>&lt;P&gt;I'd like to get the logon/logoff duration times of just one user, what would be the best SPL to go with to determine this?&amp;nbsp; Any help is greatly appreciated!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 22:39:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534862#M4623</guid>
      <dc:creator>itsmevic</dc:creator>
      <dc:date>2021-01-05T22:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Logon Duration</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534864#M4624</link>
      <description>&lt;P&gt;You need to give an example of your data, saying how time, user and logon/logoff state can be identified to get a good answer&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 22:55:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534864#M4624</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-01-05T22:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Logon Duration</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534865#M4625</link>
      <description>&lt;P&gt;I found the answer below and it works great.&amp;nbsp; I just need to now convert the seconds to minutes.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=* host=* user="username" sourcetype="WinEventLog:Security" EventCode="4624" OR EventCode=4634
| transaction user maxevents=2 startswith="EventCode=4624" endswith="EventCode=4634" maxspan=-1
| eval Logontime=if(EventCode="4624",_time,null())
| eval Logofftime=Logontime+duration
| convert ctime(Logontime) as Logontime
| convert ctime(Logofftime) as Logofftime
| table host, src_nt_host, user, Logontime, Logofftime, duration
| sort user, host, -duration
| rename duration AS "Duration (seconds)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 23:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534865#M4625</guid>
      <dc:creator>itsmevic</dc:creator>
      <dc:date>2021-01-05T23:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Logon Duration</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534868#M4627</link>
      <description>You could try eval/fieldformat duration = tostring(duration, “duration”)</description>
      <pubDate>Tue, 05 Jan 2021 23:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534868#M4627</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-01-05T23:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Logon Duration</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534870#M4628</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/191945"&gt;@itsmevic&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be aware that the transaction command may not always give you expected results, particularly if you're dealing with large data sets, as there are memory constraints. You are using maxspan=-1, which means that for every logon that has no logoff, Splunk has to keep that initial logon data in memory until it finds a logoff. It may not be an issue in this case, but worth noting.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are often easy alternatives to avoid using transaction that do not have the same constraints. See the 'Using stats instead of transaction' section here.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.1/Search/Abouttransactions" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.1/Search/Abouttransactions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 23:21:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Logon-Duration/m-p/534870#M4628</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-01-05T23:21:12Z</dc:date>
    </item>
  </channel>
</rss>

