Event Logs
Windows Event Logs and tools to query them
Last updated
Windows Event Logs and tools to query them
Last updated
Event logs record events taking place in the execution of a system to provide an audit trail that can be used to understand the activity of the system and to diagnose problems.
Security Information and Event Management (SIEM) focuses on threat detection, investigation, and time to respond. Additional features include:
Basic security monitoring
Advanced threat detection
Forensics and incident response
Log collection
Normalisation
Notifications and alerts
Security incident detection
Threat response workflow
Event logs within Windows typically reside in C:\Windows\System32\winevt\Logs
and are crucial for troubleshooting any computer incident and help understand the situation and how to remediate the incident. The following elements form event logs in Windows systems:
System Logs: Records events associated with the OS segments which include information about hardware changes, device drivers, and system changes
Security Logs: Events connected to logon and logoff activities on a device
Application Logs: Records events related to applications installed on a system which include application errors, events, and warnings
Directory Service Events: Active directory changes and activities
File Replication Service Events: Events associated with Windows Servers during the sharing of Group Policies and logon scripts to domain controllers
DNS Event Logs: DNS servers use these logs to record domain events
Custom Logs: Events logged by applications that require custom data storage
There are 3 ways of accessing event logs within Windows:
Event Viewer (GUI-based application)
Wevtutil.exe (command-line tool)
Get-WinEvent (PowerShell cmdlet)
Event Viewer, a Microsoft Management Console (MMC) snap-in, can be launched by entering eventvwr.msc
into the Windows run box. Event Viewer has three panes:
Left pane which provides a hierarchical tree listing of the event log providers
Middle pane which displays a general overview and summary of the events specific to a selected provider
Right pane which is the actions pane
This tool allows you to query event logs via the command line or PowerShell. Per Microsoft, it enables a user to retrieve information about event logs and publishers.
Example usage of wevtutil.exe
is as follows:
The cmdlet Get-WinEvent getrs events from event logs and event tracing log files on local and remote computers. It provides information on event logs and event log providers. It can combine numerous events from multiple sources into a single command and filter using XPath queries, structured XML queries, and hash table queries.
Example usage of Get-WinEvent
List of accepted key-value pairs for the Get-WinEvent FilterHashtable Parameter
LogName <string>
ProviderName <string> (Same as Source in Event Viewer)
Path <string>
Keywords <long>
ID <int32>
Level <int32>
StartTime <datetime>
<EndTime> <datetime>
UserID <SID>
Data <string>
<named-data> <string>