Windows日志筛选
发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,Windows日志筛选因工作需求开启文件系统审核,因Windows日志管理器并不方便筛选查阅,所以使用powershell方法进行筛选。一、需求分析存在问题日志量巨大(每天约1G)日志管理器查询日志不
千家信息网最后更新 2026年10月31日Windows日志筛选
Windows日志筛选
因工作需求开启文件系统审核,因Windows日志管理器并不方便筛选查阅,所以使用powershell方法进行筛选。
一、需求分析
存在问题
- 日志量巨大(每天约1G)
- 日志管理器查询日志不便
主要目标
- 启用文件系统审核
- 快捷查询用户的删除操作
- 解决方案
- 采用轮替方式归档日志(500MB)
- 日志存放60天(可用脚本删除超过期限日志档案)
- 使用Get-WinEvent中的FilterXPath过日志进行筛选,格式打印
- 删除操作码为0x10000,可对其进行筛选
二、文件审核设置
2.1 开启文件系统审核功能
- secpol.msc
- Advanced Audit Policy Configuration
- Object Access
- Audit File System
- [x] Configure the following audit events:
- [x] Success
- [x] Failure
2.2 建立共享文件夹
- Folder Properties
- Sharing
- Choose people to share with
- Everyone
2.3 设置文件夹审核的用户组
- Folder Properties
- Security
- Advanced
- Auditing
- Add user
2.4 设置日志路径及大小
- Event Viewer
- Windows Logs
- Security
- Log Properties
- Log Path: E:\FileLog\Security.evtx
- Maximum log size(KB): 512000
- [x] Archive the log when full,do not overwrite events
三、方法
- 筛选事件ID为4460日志
PS C:\Windows\system32> Get-WinEvent -LogName Security -FilterXPath "*[System[EventID=4660]]" ProviderName: Microsoft-Windows-Security-AuditingTimeCreated Id LevelDisplayName Message----------- -- ---------------- -------5/22/2018 10:01:37 AM 4660 Information An object was deleted....5/22/2018 9:03:11 AM 4660 Information An object was deleted....- 筛选文件删除日志
PS C:\Windows\system32> Get-WinEvent -LogName "Security" -FilterXPath "*[EventData[Data[@Name='AccessMask']='0x10000']]" ProviderName: Microsoft-Windows-Security-AuditingTimeCreated Id LevelDisplayName Message----------- -- ---------------- -------5/22/2018 10:01:37 AM 4663 Information An attempt was made to access an object....5/22/2018 9:03:11 AM 4663 Information An attempt was made to access an object....- 筛选指定用户文件删除日志
PS C:\Windows\system32> Get-WinEvent -LogName "Security" -FilterXPath "*[EventData[Data[@Name='AccessMask']='0x10000']] and *[EventData[Data[@Name='SubjectUserName']='lxy']]" ProviderName: Microsoft-Windows-Security-AuditingTimeCreated Id LevelDisplayName Message----------- -- ---------------- -------5/22/2018 9:03:11 AM 4663 Information An attempt was made to access an object....- 以变量方式筛选指定用户文件删除日志
PS C:\Windows\system32> $AccessMask='0x10000'PS C:\Windows\system32> $UserName='lxy'PS C:\Windows\system32> Get-WinEvent -LogName "Security" -FilterXPath "*[EventData[Data[@Name='AccessMask']='$AccessMask']] and *[EventData[Data[@Name='SubjectUserName']='$UserName']]" ProviderName: Microsoft-Windows-Security-AuditingTimeCreated Id LevelDisplayName Message----------- -- ---------------- -------5/22/2018 9:03:11 AM 4663 Information An attempt was made to access an object....- 从保存的文件筛选文件删除日志
PS C:\Users\F2844290> Get-WinEvent -Path 'C:\Users\F2844290\Desktop\SaveSec.evtx' -FilterXPath "*[EventData[Data[@Name='AccessMask']='0x10000']]"PS C:\Windows\system32> $AccessMask='0x10000'- 筛选10分钟内发生的安全性日志
XML中时间计算单位为ms,10minute=60 10 1000=600000
PS C:\Windows\system32> Get-WinEvent -LogName Security -FilterXPath "*[System[TimeCreated[timediff(@SystemTime) < 600000]]]" ProviderName: Microsoft-Windows-Security-AuditingTimeCreated Id LevelDisplayName Message----------- -- ---------------- -------5/22/2018 4:11:30 PM 4663 Information An attempt was made to access an object....5/22/2018 4:11:30 PM 4663 Information An attempt was made to access an object....5/22/2018 4:11:30 PM 4663 Information An attempt was made to access an object....5/22/2018 4:11:30 PM 4663 Information An attempt was made to access an object....- 其它筛选方法
若有语法不明之处,可参考日志管理器中筛选当前日志的XML方法。
- 删除超过60天的存档日志并记录
Get-ChildItem E:\FileLog\Archive-Security-* | Where-Object {if(( (get-date) - $_.CreationTime).TotalDays -gt 60 ){Remove-Item $_.FullName -ForceWrite-Output "$(Get-Date -UFormat "%Y/%m%d")`t$_.Name" >>D:\RoMove-Archive-Logs.txt} }四、其它文件
- 文件删除日志结构
Log Name: SecuritySource: Microsoft-Windows-Security-AuditingDate: 5/22/2018 9:03:11 AMEvent ID: 4663Task Category: File SystemLevel: InformationKeywords: Audit SuccessUser: N/AComputer: IDX-ST-05Description:An attempt was made to access an object.Subject: Security ID: IDX-ST-05\lxy Account Name: lxy Account Domain: IDX-ST-05 Logon ID: 0x2ed3b8Object: Object Server: Security Object Type: File Object Name: C:\Data\net.txt Handle ID: 0x444Process Information: Process ID: 0x4 Process Name: Access Request Information: Accesses: DELETE Access Mask: 0x10000Event Xml: 4663 0 0 12800 0 0x8020000000000000 1514 Security IDX-ST-05 S-1-5-21-1815651738-4066643265-3072818021-1004 lxy IDX-ST-05 0x2ed3b8 Security File C:\Data\net.txt 0x444 %37 0x10000 0x4 - 文件操作码表
File ReadAccesses: ReadData (or ListDirectory)AccessMask: 0x1File WriteAccesses: WriteData (or AddFile)AccessMask: 0x2File DeleteAccesses: DELETEAccessMask: 0x10000File RenameAccesses: DELETEAccessMask: 0x10000File CopyAccesses: ReadData (or ListDirectory)AccessMask: 0x1File Permissions ChangeAccesses: WRITE_DACAccessMask: 0x40000File Ownership ChangeAccesses: WRITE_OWNERAccessMask: 0x80000
日志
文件
方法
用户
系统
管理
文件夹
方式
需求
查询
巨大
不便
安全
事件
功能
单位
变量
大小
安全性
方案
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
咖啡
互联网科技工作委员会
中国互联网科技工作委员会毛军
杭州互联网科技公司
互联网科技公司官网
朗涯互联网科技
西安互联网科技公司
赫美联合互联网科技
天扬科技互联网广告
互联网和高科技公司
西藏七维空间互联网科技有限公司
中国科技互联网公司收入
互联网时代科技改变生活
互联网在线教育科技创业
佛山市拉法互联网科技有限公司
四川慕妮娅互联网科技有限公司
互联网科技股为什么大涨
广西泛欧互联网科技有限公司
北京瑞云互联网科技有限公司
银川新华互联网科技学校招聘
华服互联网科技怎么样
科技互联网龙头
互联网科技有限公司经营范围
科技信息互联网
深圳互联网科技公司
期待互联网科技
鑫亿盛互联网科技
碳银互联网科技有限公司
知域互联网科技有限公司大骗子
北京瑞云互联网科技有限公司