Hi uroni
i just want to clean up old logging. when i open up the webserver:55414 and then logs i see old (errors) from jan 2014.
can you please tell me hou to cleanup old logging ???
many many thanks
Micheal
Hi uroni
i just want to clean up old logging. when i open up the webserver:55414 and then logs i see old (errors) from jan 2014.
can you please tell me hou to cleanup old logging ???
many many thanks
Micheal
Currently only through hackery with the sqlite3 shell.
# sqlite3 backup_server.db
DELETE FROM logs;
.quit
Sorry for bringing this old thread back to life, but I think this is genuinely useful!
However, just executing the command above will leave you with a broken logging function, as logs are incorrectly referenced (so you might see logs for old clients, or different clients than the log is actually aimed at).
To really clean the logs, I had to do this:
# sqlite3 backup_server.db DELETE FROM logs; DELETE FROM log_data; .quit
This is with urbackup 2.4.13 running in docker. I am by no means a database expert, but I have not seen anything break so far.
Hi @uroni do I need everytime delete all logs or can I delete only selected logs?
Here are a short shell script to delete old logs with some filter options
sorry some changes because of timezone, now this should work.
#!/bin/bash
# Name of SQLite-file
db_file="/var/urbackup/backup_server.db"
# Define varibles
export client_name="PC01" # Client Name
export is_image=0 # 0 = file backup logs 1 = image backup logs
# Set the time at sytem timezone
older_then="2023-10-24 00:00:00"
# Convert the time to UTC using the date command
utc_offset=$(date +"%z")
older_then_utc=$(date -d "$older_then $utc_offset" -u +"%Y-%m-%d %H:%M:%S")
# SQL part
sqlite3 $db_file <<EOF
DELETE FROM log_data
WHERE logid IN (
SELECT logs.id
FROM logs
JOIN clients ON logs.clientid = clients.id
WHERE clients.name = '$client_name'
AND logs.image = '$is_image'
AND logs.created < '$older_then_utc'
);
DELETE FROM logs
WHERE clientid IN (
SELECT id
FROM clients
WHERE name = '$client_name'
)
AND image = '$is_image'
AND created < '$older_then_utc';
.quit
EOF