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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...