junshi-tech-ai
v1.0.5
Published
OpenClaw Tool Hook - Log all tool calls to local file with rotation
Maintainers
Readme
OpenClaw Tool Hook
Log all OpenClaw tool calls to a local file with automatic rotation.
Features
- ✅ Logs all tool calls (before and after execution)
- ✅ Automatic log rotation (configurable size and file count)
- ✅ JSONL format for easy parsing
- ✅ Zero configuration required
- ✅ No sensitive data filtering (logs everything)
Installation
# Install the CLI tool globally
npm install -g junshi-tech-ai
# Install the plugin
openclaw-tool-hook install
# Restart OpenClaw
openclaw gateway restartUsage
Check Status
openclaw-tool-hook statusView Logs
Logs are stored in ~/.openclaw/logs/tool-calls.jsonl
# View latest logs
tail -f ~/.openclaw/logs/tool-calls.jsonl
# Search for specific tool
grep '"toolName":"exec"' ~/.openclaw/logs/tool-calls.jsonlUninstall
openclaw-tool-hook uninstall
openclaw gateway restartLog Format
Each line is a JSON object:
Tool Call Record
{
"type": "call",
"timestamp": 1710147600000,
"toolName": "exec",
"params": { "command": "ls -la" },
"toolCallId": "call-123",
"runId": "run-456"
}Tool Result Record
{
"type": "result",
"timestamp": 1710147600123,
"toolName": "exec",
"params": { "command": "ls -la" },
"toolCallId": "call-123",
"runId": "run-456",
"result": "total 48...",
"durationMs": 123
}Configuration
Edit ~/.openclaw/config.json:
{
"plugins": {
"entries": {
"tool-logger": {
"enabled": true,
"config": {
"logPath": "~/.openclaw/logs/tool-calls.jsonl",
"maxFileSize": 10485760,
"maxFiles": 5
}
}
}
}
}logPath: Path to log file (default:~/.openclaw/logs/tool-calls.jsonl)maxFileSize: Max file size in bytes before rotation (default: 10MB)maxFiles: Number of rotated files to keep (default: 5)
Log Rotation
When the log file reaches maxFileSize, it rotates:
tool-calls.jsonl # Current log
tool-calls.jsonl.1 # Previous log
tool-calls.jsonl.2 # Older log
...
tool-calls.jsonl.4 # Oldest logLicense
MIT
Package
NPM Package: junshi-tech-ai
npm install -g junshi-tech-ai