Technical Tip: Exporting audit logs to CSV from backend
| Description | This article provides detailed steps for exporting audit logs stored in the PostgreSQL database to a CSV file for backup, review, or analysis purposes. |
| Scope | FortiSOAR. |
| Solution | To export audit logs from the backend, execute the following command as the root user:
env PGPASSWORD=$(csadm license --get-device-uuid) psql -U cyberpgsql -d gateway -c "\COPY auditlogs TO '/tmp/auditlogs.csv' CSV HEADER"
Explanation:
Notes:
Example (Custom Output Path):
env PGPASSWORD=$(csadm license --get-device-uuid) psql -U cyberpgsql -d gateway -c "\COPY auditlogs TO '/tmp/auditlogs_$(date +%F).csv' CSV HEADER" This creates a dated CSV file in a custom export folder. |
