Splunk Search

How to search for User logon time duration?

kiran331
Builder

Hi

How to search for user logon duration in a aday starting with first 4624 event and last 4634 event in the day?

Tags (1)
0 Karma

sundareshr
Legend

Try this

index=foo sourcetype=bar eventcode=4624 OR eventcode=4634 accountname=*| stats earliest(eval(if(eventcode=4624, _time, null()))) as logon latest(eval(if(eventcode=4634, _time, null()))) as logoff by accountname | eval duration=logoff-logon

If more than one logins per day, try this

index=foo sourcetype=bar eventcode=4624 OR eventcode=4634 accountname=* | reverse | streamstats count by accountname eventcode | stats earliest(eval(if(eventcode=4624, _time, null()))) as logon latest(eval(if(eventcode=4634, _time, null()))) as logoff by accountname count | eval duration=logon-logoff
0 Karma
Get Updates on the Splunk Community!

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...