Splunk Search

How do I edit my search to display Windows Active Directory users' logon_time, logoff_time, and duration in a single page?

kpavan
Path Finder

Hi All,

Need help on a Splunk search for Windows Active Directory users logon_time, logoff_time and duration in a single page. I used this search below, but not getting what expected.

index="wineventlog" source="wineventlog:security" (EventCode=4624 OR EventCode=4634) earliest=-4h | eval Date=strftime(_time, "%Y/%m/%d") | transaction src_ip user startswith=EventCode=4624 endswith=EventCode=4634 | where duration > 60  | search NOT src_ip="::1"| eval duration = duration/60 | eval duration=round(duration,2) | table  src_ip, user, duration, Date,TaskCategory | rename  duration as "Session_Duration_Minutes"  | sort  - date

Please help me on the search.

Thanks in advance!

0 Karma

javiergn
Super Champion

Field names are case sensitive so unless it is a typo in your query above try using Date instead of date with your final sort:

index="wineventlog" source="wineventlog:security" (EventCode=4624 OR EventCode=4634) earliest=-4h 
| eval Date=strftime(_time, "%Y/%m/%d") 
| transaction src_ip user startswith=EventCode=4624 endswith=EventCode=4634 
| where duration > 60 
| search NOT src_ip="::1"
| eval duration = duration/60 
| eval duration=round(duration,2) 
| table src_ip, user, duration, Date,TaskCategory 
| rename duration as "Session_Duration_Minutes" 
| sort - Date
0 Karma

kpavan
Path Finder

Hi javiergn,

Actually am getting the result, but i need like user logon time and logoff time with duration, but from my search am getting as src_ip user, Session_Duration_Minutes,Date,TaskCategory

src_ip user Session_Duration_Minutes Date TaskCategory
x.x.x.x AD$ 14.88 2016/02/01 LogoffLogon
x.x.x.x AD$ 1.58 2016/02/01 LogoffLogon

But I need like
src_ip user Session_Duration_Minutes Logon_Time Logoff_time

Thanks!

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...