Skip to content

Commit 31a96d4

Browse files
committed
chore: 将工具输入参数的说明部分移动至工具说明
1 parent e9ad963 commit 31a96d4

2 files changed

Lines changed: 36 additions & 16 deletions

File tree

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
本工具用于查询 Windows 事件日志。接受一个 LogQueryRequest 对象作为输入,返回符合查询条件的 Windows 事件日志条目列表。
2-
你可以使用此工具来获取特定日志名称、级别和时间范围内的事件日志,以帮助诊断和分析 Windows 系统中的问题。
3-
4-
## 核心解析规则
5-
1. 元数据 (头部):
6-
- hasMore: 若为 true,表示当前时间范围内的日志数量超过了返回限制 (被截断)。可以增大 'maxEvents' 参数再次查询,以获取遗漏的日志。
7-
- userContext (权限):
8-
- isAdmin: **读取 Security (安全) 日志必须为 true**。若为 false 且查询结果为空,务必建议用户以管理员身份运行。
9-
- isReader: 若为 true,表示用户属于 Event Log Readers 组,可读取除 Security 外的系统日志。
1+
# Windows 事件日志查询工具
2+
3+
## 参数说明
4+
1. `logName` (String, 必填):
5+
- 目标日志名称。
6+
- 常用值: `Application` (应用程序), `System` (系统), `Security` (安全), `Setup` (安装)。
7+
- 注意: 查询 `Security` 日志通常需要管理员权限。
8+
9+
2. `levels` (List<Enum>, 选填):
10+
- 筛选日志级别。
11+
- **App/System**: 仅查 `Error`, `Warning`, `Critical`,除非必要请忽略 `Information` 以降噪。
12+
- **Security**: 必须包含 `Information`,因为关键审核事件(如登录失败、提权)均属此级别。
13+
14+
3. `startHoursAgo / endHoursAgo` (Integer, 选填):
15+
- **重要**: 必须传递**正整数**
16+
- `startHoursAgo`: 查询的**起始点**(多少小时前)。例如 `24` 表示从 24 小时前开始。
17+
- `endHoursAgo`: 查询的**结束点**(多少小时前)。例如 `1` 表示截止到 1 小时前。
18+
- 逻辑: `startHoursAgo` 的值通常应**大于** `endHoursAgo`
19+
- 示例: 查询“昨天”的日志,可设 `startHoursAgo=48, endHoursAgo=24`
20+
21+
4. `maxEvents` (int, 选填):
22+
- 限制返回条数,默认 10。
23+
24+
## 结果解析
25+
1. 元数据:
26+
- `hasMore`: 若为 true,表示当前时间范围内的日志数量超过了返回限制。可以增大 `maxEvents` 参数再次查询,以获取遗漏的日志。
27+
- `userContext`:
28+
- `isAdmin`: **读取 Security 日志必须为 true**。若查 Security 且此值为 false,务必建议用户以管理员身份运行探针。
29+
- `isReader`: 若为 true,表示用户属于 Event Log Readers 组,可读取除 Security 外的系统日志。
1030
2. 日志条目 (entries):
11-
- Id: 故障检索核心关键字 (如 10016)。
12-
- Message: 重点提取其中的错误码 (HResult) 及 DCOM 组件的 CLSID/APPID。
31+
- `Id`: 故障检索核心关键字 (如 10016)。
32+
- `Message`: 重点提取其中的错误码 (HResult) 及 DCOM 组件的 CLSID/APPID。

win-diag-doctor-protocol/src/main/java/cn/teacy/wdd/protocol/command/LogQueryRequest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,37 @@ public class LogQueryRequest extends WsMessagePayload {
2121
*
2222
* @see cn.teacy.wdd.common.constants.LogNames
2323
*/
24-
@JsonPropertyDescription("需要查询的日志名称,例如 `Application`, `System`, `Security` 等。")
24+
@JsonPropertyDescription("Log name (e.g. Application, Security)")
2525
private String logName;
2626

2727
/**
2828
* 要查询的日志级别
2929
*
3030
* @see LogLevel
3131
*/
32-
@JsonPropertyDescription("需要查询的日志级别列表")
32+
@JsonPropertyDescription("List of log levels")
3333
private List<LogLevel> levels;
3434

3535
/**
3636
* 最大事件数
3737
*/
38-
@JsonPropertyDescription("最大事件数,默认10")
38+
@JsonPropertyDescription("Max events limit, defaults to 10")
3939
private int maxEvents = 10;
4040

4141
/**
4242
* 查询多早之前的日志,单位:小时
4343
*
4444
* @apiNote 应该传递正值,表示“多少小时前”,而不是负值
4545
*/
46-
@JsonPropertyDescription("查询多早之前的日志,单位:小时,应该传递正值,表示`多少小时前开始`")
46+
@JsonPropertyDescription("Query logs starting from how many hours ago, should be a positive value")
4747
private Integer startHoursAgo;
4848

4949
/**
5050
* 查询到多早之前的日志,单位:小时
5151
*
5252
* @apiNote 应该传递正值,表示“多少小时前”,而不是负值
5353
*/
54-
@JsonPropertyDescription("查询到多早之前的日志,单位:小时,应该传递正值,表示`多少小时前结束`")
54+
@JsonPropertyDescription("Query logs up to how many hours ago, should be a positive value")
5555
private Integer endHoursAgo;
5656

5757
}

0 commit comments

Comments
 (0)