I've been monitoring my servers and it looks like log rotation just isn't happening at all. I've checked the cron jobs, and everything seems set up correctly, plus permissions appear fine. There's nothing in the error logs indicating any issues. I've tried tweaking some configs and even restarted a couple of times. Maybe I'm overthinking it or maybe I'm missing something. I can manually rotate the logs, but it feels like I'm battling the system for no reason. Should I resort to writing a simple nightly script to move everything over, or is there some setting that I might not be aware of that actually makes log rotation work? I mainly have nginx logs and some app logs, nothing too complicated, but I'm already seeing 40-50GB piling up. Does anyone have a reliable method that doesn't turn into a full-time task?
2 Answers
Can you share what tool or version you're using along with the relevant config? The issue could be specific to your setup. It's crucial to run logrotate with the `--debug` option to see what it is attempting to do. If it's saying it would rotate but it's not actually happening, there has to be something being missed somewhere. Also, check the logs for any verbose output that could provide clues.
You shouldn't need to write a separate script to manage your logs. If logrotate is set up correctly and working, it should handle everything for you automatically. Double-check the configuration files and make sure the settings haven’t been altered unexpectedly. Sometimes, simple things like missing paths or syntax errors can cause it to fail silently.

Fair point! I'm mostly dealing with nginx logs on Ubuntu 24.04 and I'm using the default logrotate configurations. Cron seems fine, and when I ran `logrotate -d /etc/logrotate.conf`, it indicated it would rotate everything. Permissions are also okay, but it just doesn't execute at the scheduled time.