75 lines
2.8 KiB
Markdown
75 lines
2.8 KiB
Markdown
---
|
||
name: inspect-shz-logs
|
||
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
|
||
|
||
Use the bundled script instead of assembling SSH commands manually. Keep every initial read bounded; follow logs only when the user explicitly asks to monitor live activity.
|
||
|
||
## Inspect local logs
|
||
|
||
Read the last 200 lines:
|
||
|
||
```bash
|
||
.codex/skills/inspect-shz-logs/scripts/view.sh local 200
|
||
```
|
||
|
||
Follow the local log interactively:
|
||
|
||
```bash
|
||
.codex/skills/inspect-shz-logs/scripts/view.sh local 200 --follow
|
||
```
|
||
|
||
## Inspect production logs
|
||
|
||
Read the main application log:
|
||
|
||
```bash
|
||
.codex/skills/inspect-shz-logs/scripts/view.sh online backend 200
|
||
```
|
||
|
||
Read the current error log:
|
||
|
||
```bash
|
||
.codex/skills/inspect-shz-logs/scripts/view.sh online error 200
|
||
```
|
||
|
||
`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:
|
||
|
||
```bash
|
||
.codex/skills/inspect-shz-logs/scripts/view.sh online error 1000 | rg -i 'exception|error|failed'
|
||
```
|
||
|
||
## Diagnose from logs
|
||
|
||
1. Establish whether the request concerns local, test, or production behavior.
|
||
2. Read 100–300 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 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.
|