feat: Enhance log inspection and querying capabilities for test environments

This commit is contained in:
2026-07-15 16:13:46 +08:00
parent 5a926e36fc
commit 708d779533
8 changed files with 147 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
---
name: inspect-shz-logs
description: Inspect and follow the SHZ backend's local and production logs through bounded, read-only commands. Use when Codex is working in the shz-backend project and needs to diagnose startup failures, exceptions, request behavior, scheduled jobs, or runtime incidents from local backend.log or the production backend, error, info, and user logs on the shz server.
description: Inspect and follow the SHZ backend's local, test, and production logs through bounded, read-only commands. Use when Codex is working in the shz-backend project and needs to diagnose startup failures, exceptions, request behavior, scheduled jobs, or runtime incidents from local backend.log or the test and production backend, error, info, and user logs.
---
# Inspect SHZ Logs
@@ -35,7 +35,25 @@ Read the current error log:
.codex/skills/inspect-shz-logs/scripts/view.sh online error 200
```
Choose only one production log type: `backend`, `error`, `info`, or `user`. Add `--follow` as the final argument only for an explicit live-monitoring request.
`online` is the existing production-environment name and remains supported. `production` is an equivalent alias.
Choose only one log type: `backend`, `error`, `info`, or `user`. Add `--follow` as the final argument only for an explicit live-monitoring request.
## Inspect test logs
Read the main test-environment application log:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh test backend 200
```
Read the current test-environment error log:
```bash
.codex/skills/inspect-shz-logs/scripts/view.sh test error 200
```
The test environment uses the same four log types as production. The default test server is `root@47.111.103.66` on SSH port `22`; the endpoint and log directory can be overridden with `SHZ_TEST_SSH_HOST`, `SHZ_TEST_SSH_PORT`, and `SHZ_TEST_LOG_DIR` when the server layout changes.
For keyword analysis, fetch a bounded window and filter locally, for example:
@@ -45,12 +63,12 @@ For keyword analysis, fetch a bounded window and filter locally, for example:
## Diagnose from logs
1. Establish whether the request concerns local or production behavior.
1. Establish whether the request concerns local, test, or production behavior.
2. Read 100300 recent lines from the relevant log.
3. Expand up to the script's 5,000-line cap only when timestamps or stack traces require more context.
4. Correlate timestamps, thread names, exception causes, and nearby requests.
5. Report the evidence and likely cause without exposing tokens, passwords, personal data, or unrelated log content.
Treat production access as read-only. Never restart services, edit files, deploy code, truncate logs, or run arbitrary remote commands through this skill.
Treat test and production access as read-only. Never restart services, edit files, deploy code, truncate logs, or run arbitrary remote commands through this skill.
Read [references/log-locations.md](references/log-locations.md) only when checking server identity, paths, or supported log types.