Files
mdm/log_mapping_table.md

102 lines
4.8 KiB
Markdown

# 用户操作到日志条目映射表
基于 javap 反编译分析结果
| Action Name | Target Service Class | Log Category (update/activity/event) | Log Content Pattern (Regex) |
| :--- | :--- | :--- | :--- |
| Profile Apply | DeviceReportService | update | `Configuration profile '.*\(.*\)' has been applied\.` |
| Group Assign | DeviceService | update | `Device group assigned: .*` |
| App Install | DeviceReportService | activity | `App\(.*\) has been added\.` |
| App Uninstall | DeviceAppsService | activity | `App\(.*\) has been removed\.` |
| OS Update | DeviceService | activity | `Region image has been updated to .* from .*\.` |
| Media Mount | DeviceReportService | activity | `Media\(.*\) has been mounted\.` |
| Media Unmount | DeviceReportService | activity | `Media\(.*\) has been unmounted\.` |
| Enroll | DeviceService | event | `Enrolled\.` |
| Connect | DeviceService | event | `Connected-.*` |
| Disconnect | DeviceService | event | `Disconnected\(.*\)` |
| Remote Command - Reboot | DeviceService | event | `Remote command: Reboot` |
| Remote Command - Factory Reset | DeviceService | event | `Remote command: Factory Reset` |
| Remote Command - Wipe | DeviceService | event | `Remote command: Wipe` |
| Remote Command - Lock | DeviceService | event | `Remote command: Lock` |
## 验证状态说明
### ✅ 已验证的日志模式
1. **Profile Apply**:
- ✅ 在 `DeviceReportService.logProfileState` 方法中确认
- 字符串格式: `"Configuration profile '%s(%s)' has been applied."`
- 位置: DeviceReportService_javap.txt:692
- Category: "update"
2. **OS Update (Region Image)**:
- ✅ 在 `DeviceService.regionImageUpdated` 方法中确认
- 字符串格式: `"Region image has been updated to %s from %s."`
- 位置: DeviceService_javap.txt:3249
- Category: "activity"
3. **OS Update (System Image)**:
- ✅ 在 `DeviceService.systemImageUpdated` 方法中确认
- 字符串格式: `"System image has been %s to %s from %s."`
- 位置: DeviceService_javap.txt:3180-3205
- Category: "activity"
### ⚠️ 部分确认的日志模式
1. **Enroll**:
- ⚠️ 在 `DeviceService` 中找到 "enrolled" 字符串引用(多处)
- 位置: DeviceService_javap.txt:4546, 6336, 6370, 6387
- 状态: 找到字段引用,但**未找到具体的日志记录代码**
- 可能格式: "Enrolled." 或 "enrolled"(需要进一步确认)
### ❌ 未找到的日志模式
以下模式在 javap 反编译文件中**未找到**明确的日志记录代码:
1. **Group Assign**:
- ❌ 在 DeviceService_javap.txt 中搜索 "Device group assigned" 未找到
- 推断格式: `"Device group assigned: %s"`(基于映射表)
2. **App Install**:
- ❌ 在 DeviceReportService_javap.txt 和 DeviceAppsService_javap.txt 中未找到
- 推断格式: `"App(%s) has been added."`(基于映射表)
3. **App Uninstall**:
- ❌ `DeviceAppsService.removeDeviceApp` 方法存在,但**无日志记录代码**
- 推断格式: `"App(%s) has been removed."`(基于映射表)
4. **Media Mount**:
- ❌ 在 DeviceReportService_javap.txt 中未找到
- 推断格式: `"Media(%s) has been mounted."`(基于映射表)
5. **Media Unmount**:
- ❌ 在 DeviceReportService_javap.txt 中未找到
- 推断格式: `"Media(%s) has been unmounted."`(基于映射表)
6. **Connect**:
- ❌ 在 DeviceService_javap.txt 中未找到(仅找到 "lastDisconnected" 字段引用)
- 推断格式: `"Connected-%s"`(基于映射表)
7. **Disconnect**:
- ❌ 在 DeviceService_javap.txt 中未找到(仅找到 "lastDisconnected" 字段引用)
- 推断格式: `"Disconnected(%s)"`(基于映射表)
8. **Remote Commands**:
- ❌ 在 DeviceService_javap.txt 中未找到
- 推断格式: `"Remote command: Reboot"` 等(基于映射表)
### 可能的原因
1. **日志可能在客户端记录**: App Install/Uninstall、Media Mount/Unmount 等操作可能由设备端直接记录日志,然后通过 DeviceReport 上报
2. **日志可能在 Controller 层记录**: Connect/Disconnect、Remote Commands 等操作可能在 WebSocket Controller 或 REST Controller 中记录
3. **日志可能使用不同的格式**: 实际日志格式可能与推断的不同
4. **日志可能在其他服务类中**: 可能存在独立的 LogService 或 EventService 处理这些日志
### 建议的下一步
1. ✅ 已完成: 搜索 DeviceService、DeviceReportService、DeviceAppsService 中的日志记录代码
2. 🔄 进行中: 搜索 Controller 层(WebSocket、REST API)中的日志记录
3. ⏳ 待完成: 搜索其他可能的服务类(如 EventService、RemoteCommandService 等)
4. ⏳ 待完成: 检查 DeviceReport 上报的数据中是否包含日志信息
5. ⏳ 待完成: 查看实际的日志数据库,验证日志格式