"Valladolid": Cleaner not cleaning
Scenario: "Valladolid": Cleaner not cleaning
Level: Easy
Type: Fix
Tags: systemd
Access: Email
Description: The systemd service log-cleaner.service is supposed to be run manually (not a timer or cron job) and delete log files older than 7 days in the /var/log/app directory.
The service runs successfully (exit code 0), but no logs are ever deleted.
Fix the service and/or the script so that old_data.log (older than 7 days) is deleted, but recent_data.log is preserved.
If you accidentally delete the wrong files while debugging, run ~/reset_logs.sh to restore them.
Root (sudo) Access: True
Test: Running sudo systemctl restart log-cleaner deletes the file /var/log/app/old_data.log but not /var/log/app/recent_data.log
The "Check My Solution" button runs the script /home/admin/agent/check.sh, which you can see and execute.
Time to Solve: 20 minutes.