Session Log Analyzer
Analyze JSONL session logs, produce PDF reports, and sync to Notion.
Workflow
- Analyze logs → Run
scripts/analyze_logs.pyagainst a.jsonllog file - Generate PDF → The script outputs a PDF report using
nano_pdf - Sync to Notion → Run
scripts/sync_to_notion.pyto push the report
Analyze Logs & Generate PDF
python scripts/analyze_logs.py /path/to/logs.jsonl /path/to/output_report.pdf
If args are omitted, defaults:
- Log file:
/workspace/session_logs/sample_logs.jsonl - Output:
/workspace/pdfs/session_analysis_report.pdf
Sync to Notion
Requires env vars: NOTION_API_KEY, NOTION_REPORTS_DB_ID
python scripts/sync_to_notion.py /path/to/report.pdf
Default PDF path: /workspace/pdfs/session_analysis_report.pdf
Scheduled Daily Reports
A cron-driven daily task can run at 02:00 to auto-analyze, generate PDF, and sync to Notion.
See tmux_scripts/daily-log-report.sh in the workspace root for the scheduled task script. It is loaded automatically when the dev tmux session starts.
Manual trigger
/root/.openclaw/workspace/tmux_scripts/daily-log-report.sh now
Configuration
| Variable | Description |
|---|---|
NOTION_API_KEY | Notion integration token |
NOTION_REPORTS_DB_ID | Notion database ID for reports |
SESSION_LOG_DIR | Directory containing .jsonl log files (default: /workspace/session_logs) |
PDF_OUTPUT_DIR | Directory for generated PDFs (default: /workspace/pdfs) |
Log Format
Expects JSONL with fields: event, session_id, timestamp, skill_used, success, duration, error (optional).
See references/log-schema.md for full schema details.