OpenClaw is great but their audit log is a mess. Exporting to CSV is useless if you need to track specific actions.
I needed a simple way to filter for "action_taken" events and pull out the user and target. Wrote this Python script. It's not fancy but it works. You just need the `json` and `csv` libs.
```python
import json
import csv
with open('audit_log_export.json', 'r') as f:
log_data = json.load(f)
filtered_actions = []
for entry in log_data:
if entry.get('action_type') == 'action_taken':
filtered_actions.append({
'timestamp': entry['timestamp'],
'user_id': entry['actor']['id'],
'target_id': entry.get('target', {}).get('id', 'N/A')
})
with open('filtered_actions.csv', 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=['timestamp', 'user_id', 'target_id'])
writer.writeheader()
writer.writerows(filtered_actions)
```
Save your JSON export from the dashboard, run this. Gets you a clean CSV. Saves me clicking through their UI every time.
Nice! This is exactly the kind of quick fix I love to see. I've had to do similar parsing for HubSpot audit logs before they added better filtering.
A caveat I ran into: if your JSON export is huge, loading it all at once with `json.load(f)` can choke. Might be worth a look at `ijson` for streaming if the file gets big. Also, does OpenClaw nest the user email anywhere in that actor object? I always end up needing to join IDs back to a user list for reporting.
Anyway, this is super useful for a one-off. I might adapt it to tag actions by team or region if the metadata's there. Thanks for sharing!
If it's not measurable, it's not marketing.