Hi,
Below is an excerpt of an ossec log file. What I wanted to do is to locate/search a users time of log on by:
1. searching the user's uname in the line with "Successful Network Logon"
2. getting the line with the date/time "2009 May 21 09:00:54" just before the line where #1 was retrieved.
Hoping you could help me on this

-------------------------------------------------------------------------
Code:
** Alert 1242867654.171407408: - windows,authentication_success,
2009 May 21 09:00:54 (dc1) 10.11.20.4->WinEvtLog
Rule: 18107 (level 3) -> 'Windows Logon Success.'
Src IP: (none)
User: hostname
WinEvtLog: Security: AUDIT_SUCCESS(540): Security: hostname: PSB: dc1: Successful Network Logon: User Name: hostname
** Alert 1242867656.171408138: - windows,
2009 May 21 09:00:56 (filesvr) 10.11.40.108->WinEvtLog
Rule: 18149 (level 3) -> 'Windows User Logoff.'
Src IP: (none)
User: testuser01
WinEvtLog: Security: AUDIT_SUCCESS(538): Security: testuser01: PSB: FILESVR: User Logoff: User Name: testuser
** Alert 1242867657.171408505: - windows,authentication_success,
2009 May 21 09:00:57 (ftpsvr) 10.11.40.24->WinEvtLog
Rule: 18107 (level 3) -> 'Windows Logon Success.'
Src IP: (none)
User: testuser02
WinEvtLog: Security: AUDIT_SUCCESS(540): Security: ftpsvr: ftpsr: svr01: Successful Network Logon: User Name: ftpsvr
** Alert 1242867658.171408999: - windows,
2009 May 21 09:00:58 (mailsvr) 10.11.41.70->WinEvtLog
Rule: 18149 (level 3) -> 'Windows User Logoff.'
Src IP: (none)
User: testuser03
WinEvtLog: Security: AUDIT_SUCCESS(538): Security: testuser03: PSB: mailsvr: User Logoff: User Name: testuser03