过滤相关参数查看事件日志数据

# 利用XPath查询

利用XPath来过滤事件日志数据,使用如下图: xml.jpg

该查询是登录类型数据字段设置为10的安全日志中分别查找事件ID 46244634,登录和注销。

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
    *[System[(Level=4 or Level=0) and (EventID=4624 or EventID=4634)]] and 
    *[EventData[Data[@Name='LogonType']='10']] and (*[EventData[Data[5]='10']] or 
    *[EventData[Data[@Name='AuthenticationPackageName']='Negotiate']])
    </Select>
  </Query>
</QueryList>
1
2
3
4
5
6
7
8
9

该查询是登录类型数据字段设置为10的安全日志中分别查找事件ID 4624,登录成功,并过滤匿名登录。

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
    *[System[(Level=4 or Level=0) and (EventID=4624)]] and 
    *[EventData[Data[@Name='LogonType'] and (Data='3')]] and 
    *[EventData[Data[@Name='AuthenticationPackageName'] ='NTLM']] and 
    *[EventData[Data[@Name='TargetUserName'] !='ANONYMOUS LOGON']]
    </Select>
   </Query>
</QueryList>
1
2
3
4
5
6
7
8
9
10

远程登录查询 登录成功 查找事件ID 4648 (opens new window) 有记录IP地址

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
    *[System[(EventID=4648)]] and 
    *[EventData[Data[@Name='IpAddress'] !='-']]
    </Select>
  </Query>
</QueryList>
1
2
3
4
5
6
7
8

远程登录查询 登录失败 查找事件ID 4625 (opens new window) 有记录IP地址

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
    *[System[(EventID=4625)]] and 
    *[EventData[Data[@Name='IpAddress'] !='-']]
    </Select>
  </Query>
</QueryList>
1
2
3
4
5
6
7
8

# 使用powershell查询

远程登录查询 登录成功 查找事件ID 4648 (opens new window) 有记录IP地址

Get-WinEvent -LogName Security -FilterXPath "*[System[EventID=4648]] and *[EventData[Data[@Name='IpAddress'] !='-']]" | Select-Object -Property  TimeCreated,TaskDisplayName,Message | Format-list
1

未更新完...

# 参考链接