Export restore logs


#1

Every year I have an audit (SOX and ISO), and I must show that once per month I did a restore test of a backup.
There is a way to export restore jobs logs?
Thanks!


#2

Only by directly using the db. For example sqlite3 /var/urbackup/backup_server.db:

.output output.csv
.mode csv
.header on
SELECT * FROM (logs INNER JOIN log_data ON logs.id=log_data.logid) WHERE restore=1;

#3

Thanks!
I used this SQL:

SELECT c.name, r.created, CASE r.success WHEN 1 THEN 'true' ELSE 'false' END AS success, r.letter FROM restores AS r INNER JOIN clients AS c ON r.clientid = c.id
UNION
SELECT c.name, logs.created, CASE logs.errors WHEN 0 THEN 'true' ELSE 'false' END AS success, REPLACE(REPLACE(log_data.data, CHAR(13), ''), CHAR(10), ', ') AS data FROM (clients AS c INNER JOIN logs ON c.id = logs.clientid INNER JOIN log_data ON logs.id=log_data.logid) WHERE restore=1
ORDER BY r.created DESC, logs.created DESC;