How can I configure a daily logrotation for all virtual servers? When I set it up to “Daily” in Log Rotation Settings in Webmin all change to Daily but the Virtual Servers still have Weekly. I must change every single one to Daily. (The same for the Numer of saved logs).
And how can I make it possible to save all log backups with a timestamp in the filename?
I’m not sure whether or not Virtualmin can change that for you for existing Virtual Servers; but, it shouldn’t be too hard to do that manually.
The config for that is in /etc/logrotate.conf. You’d just need to change the various lines that mention “weekly” to “daily”.
As far as how to add a date to the filename – looking at the logrotate manpage, it appears as if you can accomplish that by adding in this directive to each section:
dateext
For example, you can put that underneath where you put the “daily” in the logfile.
Ok, thank for your help. But when I crate a new Virtual Server he don’t choose the settings I set up in the Global Configuration, instead he takes the default ones. I’d like to know how I can get this running properly.
You should be able to tweak what is used for logfile rotation by going into System Settings -> Server Templates -> Logfile Rotation – and then just adding the directives you want to use into “Logrotate directives for new servers” rather than using the default “Automatic” setting.
Now, to make it perfect it would be nice if there is a possibility to make a folder for each day (with the date as folder name) and then to move the logs in it. But I think this wont be possible without a script and a cronjob.
Yeah, while it does look like you can move them into another directory (using logrotate’s “olddir” option), it doesn’t look like you can create a dir with the date on it without writing your own script to do so