Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using XPath starts-with or contains functions to search Windows event logs

By editing the XML filter query manually in Windows event viewer, I can find events where the data matches a string exactly:

<QueryList>   <Query Id="0" Path="Application">     <Select Path="Application">*[EventData[Data and (Data="Session end: imzcjflrrsq1sfdk3okc4jpf")]]</Select>   </Query> </QueryList> 

Now, I want to do a partial match:

<QueryList>   <Query Id="0" Path="Application">     <Select Path="Application">*[EventData[Data and (Data[starts-with(.,"Session")])]]</Select>   </Query> </QueryList> 

Event log gives me the error:

The specified query is invalid

Do I have the syntax wrong?

like image 365
Keith Walton Avatar asked Dec 29 '11 17:12

Keith Walton


People also ask

How do I gather Windows event logs?

Click "Control Panel" > "System and Security" > "Administrative Tools", and then double-click "Event Viewer" Click to expand "Windows Logs" in the left pane, and then select "Application". Click the "Action" menu and select "Save All Events As".

What tool is used to look at logs of System events?

SolarWinds Log Analyzer (FREE TRIAL) SolarWinds Log Analyzer is an event log monitoring tool for Windows that collects event log data. You can monitor event log data in real-time through syslog, SNMP traps, and system event logs. Data can be collected and monitored through one user interface.

What are the five types of event logs What does each one of them represent and describe?

Types of Event Logs They are Information, Warning, Error, Success Audit (Security Log) and Failure Audit (Security Log). An event that describes the successful operation of a task, such as an application, driver, or service. For example, an Information event is logged when a network driver loads successfully.


1 Answers

Windows Event Log supports a subset of XPath 1.0. It has only three functions: position, Band, timediff.

Reference: https://docs.microsoft.com/en-us/windows/desktop/WES/consuming-events#xpath-10-limitations

like image 163
Kirill Polishchuk Avatar answered Sep 16 '22 12:09

Kirill Polishchuk