日志目录可配置化:把 OpenClaw logs 移到受管磁盘路径
问题:默认日志目录在某些容器/只读环境不方便做容量与权限管控。做法:显式配置 log dir 到受管路径,并验证轮转与权限。
GITHUBDiscovered 2026-02-18Author @sriharikapu
Prerequisites
- Host has a writable persistent path for logs (for example /var/log/openclaw or mounted volume).
- Operator can update gateway config/service env and restart service.
Steps
- Create target log directory with least-privilege permissions for OpenClaw runtime user.
- Set log directory in config/env according to your version’s logging options.
- Restart gateway and generate test events (status/probe/tool call) to force log writes.
- Validate new files are written in target path and old path no longer grows.
Commands
mkdir -p /var/log/openclawopenclaw gateway statusopenclaw gateway restartopenclaw logs --local-timeVerify
After restart, fresh gateway logs are emitted to the configured directory with correct ownership/permissions.
Caveats
- Exact config key for log directory may differ across builds (standalone/npm/docker)(需验证).
- If log rotation is not configured on the new path, disk usage can grow silently.
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗