1.6 KiB
1.6 KiB
Log Monitor Skill
Automatic log scanning and error repair for OpenClaw/agent systems.
Purpose
Runs daily at 2 AM to:
- Scan system logs (journald, cron, OpenClaw) for errors
- Attempt safe auto-fixes for known issues
- Report unhandled errors needing human attention
Auto-Fixes Supported
| Error Pattern | Fix Action |
|---|---|
Missing Python module (ModuleNotFoundError) |
pip install <module> |
| Permission denied on temp files | chmod 755 <path> |
| Ollama connection issues | systemctl restart ollama |
| Disk full | Alert only (requires manual cleanup) |
| Service down (connection refused) | Alert only (investigate first) |
Usage
Manual Run
cd /root/.openclaw/workspace/skills/log-monitor/scripts
python3 log_monitor.py
View Latest Report
cat /tmp/log_monitor_report.txt
Cron Schedule
Runs daily at 2:00 AM via openclaw cron.
Adding New Auto-Fixes
Edit log_monitor.py and add to AUTO_FIXES dictionary:
AUTO_FIXES = {
r"your-regex-pattern-here": {
"fix_cmd": "command-to-run {placeholder}",
"description": "Human-readable description with {placeholder}"
},
}
Use {module}, {path}, {port}, {service} as capture group placeholders.
Set "alert": True for issues that should notify you but not auto-fix.
Safety
- Only "safe" fixes are automated (package installs, restarts, permissions)
- Critical issues (disk full, service down) alert but don't auto-fix
- All actions are logged to
/tmp/log_monitor_report.txt - Cron exits with code 1 if human attention needed (triggers notification)