Logs are only useful if you can actually get to them. If your OpenClaw QQ bot's logs are trapped on a server that only one person has SSH access to, you don't have observability — you have a single point of failure with a human attached.
Let's set up proper log export so your entire team can access, analyze, and archive your QQ bot's operational data.
An OpenClaw QQ bot on Tencent Cloud Lighthouse produces several log streams:
By default, these live in journald and /var/log/clawdbot/. The goal is to get them out of the server and into formats your team can work with.
The simplest approach — pull logs to your local machine:
# Export today's logs
ssh root@YOUR_LIGHTHOUSE_IP "journalctl -u clawdbot --since today --no-pager" > clawdbot-$(date +%Y%m%d).log
# Export error logs only
ssh root@YOUR_LIGHTHOUSE_IP "journalctl -u clawdbot --since today -p err --no-pager" > clawdbot-errors-$(date +%Y%m%d).log
# Download the full log directory
scp -r root@YOUR_LIGHTHOUSE_IP:/var/log/clawdbot/ ./clawdbot-logs/
This works for ad-hoc debugging, but it doesn't scale.
For analysis in tools like jq, Excel, or log aggregation platforms, export in JSON:
# On the Lighthouse instance
journalctl -u clawdbot --since "24 hours ago" -o json --no-pager > /tmp/clawdbot-export.json
# Filter and transform with jq
cat /tmp/clawdbot-export.json | jq -r '{
timestamp: .REALTIME_TIMESTAMP,
priority: .PRIORITY,
message: .MESSAGE
}' > /tmp/clawdbot-clean.json
For a CSV export that non-technical team members can open in a spreadsheet:
#!/bin/bash
# /opt/clawdbot/export-csv.sh
echo "timestamp,level,group_id,user_id,message_type,tokens_used" > /tmp/clawdbot-report.csv
journalctl -u clawdbot --since "24 hours ago" -o json --no-pager | \
jq -r 'select(.MESSAGE | test("msg_processed")) |
[.REALTIME_TIMESTAMP, .PRIORITY,
(.MESSAGE | capture("group=(?<g>[^ ]+)").g // "N/A"),
(.MESSAGE | capture("user=(?<u>[^ ]+)").u // "N/A"),
(.MESSAGE | capture("type=(?<t>[^ ]+)").t // "N/A"),
(.MESSAGE | capture("tokens=(?<tk>[0-9]+)").tk // "0")] |
@csv' >> /tmp/clawdbot-report.csv
echo "Exported $(wc -l < /tmp/clawdbot-report.csv) records"
Set up a cron job that exports and archives logs every night:
#!/bin/bash
# /opt/clawdbot/daily-export.sh
DATE=$(date +%Y%m%d)
EXPORT_DIR="/opt/clawdbot/exports"
mkdir -p $EXPORT_DIR
# Export full logs
journalctl -u clawdbot --since "yesterday" --until "today" --no-pager \
> "$EXPORT_DIR/clawdbot-$DATE.log"
# Export errors separately
journalctl -u clawdbot --since "yesterday" --until "today" -p err --no-pager \
> "$EXPORT_DIR/clawdbot-errors-$DATE.log"
# Compress
gzip "$EXPORT_DIR/clawdbot-$DATE.log"
gzip "$EXPORT_DIR/clawdbot-errors-$DATE.log"
# Clean up exports older than 90 days
find $EXPORT_DIR -name "*.gz" -mtime +90 -delete
echo "[$DATE] Export complete"
Add to crontab:
echo "0 1 * * * /opt/clawdbot/daily-export.sh >> /var/log/clawdbot/export.log 2>&1" | crontab -
For teams that need real-time log access without SSH, ship logs to a remote endpoint:
# Using rsyslog to forward to a remote log server
cat > /etc/rsyslog.d/60-clawdbot-remote.conf <<'EOF'
module(load="imfile")
input(type="imfile"
File="/var/log/clawdbot/output.log"
Tag="clawdbot-qq"
Severity="info"
Facility="local0")
local0.* @@your-log-server.example.com:514
EOF
sudo systemctl restart rsyslog
All of this requires a stable, always-on server with proper log management built in. That's exactly what Lighthouse provides.
Define how long you keep logs at each tier:
| Tier | Location | Retention | Format |
|---|---|---|---|
| Hot | journald | 7 days | Binary |
| Warm | /var/log/clawdbot/ | 30 days | Compressed text |
| Cold | /opt/clawdbot/exports/ | 90 days | Compressed archives |
| Archive | Object storage | 1 year+ | Compressed archives |
For the archive tier, upload to cloud object storage:
# Weekly archive to object storage
tar czf /tmp/clawdbot-weekly-$(date +%Y%W).tar.gz /opt/clawdbot/exports/
# Upload using your preferred CLI tool
Exported logs are useless if nobody reads them. Create a weekly summary that highlights what matters:
#!/bin/bash
echo "=== Weekly QQ Bot Log Summary ==="
echo "Total messages processed: $(grep -c 'msg_processed' /var/log/clawdbot/output.log)"
echo "Total errors: $(grep -c 'ERROR' /var/log/clawdbot/error.log)"
echo "Unique users: $(grep -oP 'user=\K[^ ]+' /var/log/clawdbot/output.log | sort -u | wc -l)"
echo "Top 5 error types:"
grep 'ERROR' /var/log/clawdbot/error.log | grep -oP 'type=\K[^ ]+' | sort | uniq -c | sort -rn | head -5
Log export is the foundation of operational maturity. Once you can reliably get logs out of your server, you can build dashboards, set up alerts, and make data-driven decisions about your bot.
If you can't export it, you can't improve it.