0

Ubuntu 18.04 has default configurations of packages for logrotate in /etc/logrotate.d

For example with nginx installed I have a file /etc/logrotate.d/nginx

/var/log/nginx/*.log {
        daily
        missingok
        rotate 14
        [..]
}

Where can I modify these settings? Should I just edit the file?

Since I guess this file came with the nginx package I don't want it to overwrite my settings or complain when nginx is updated.

0

Yes, you should control logrotate by editing files in /etc/logrotate.conf.d. First, read man logrotate logrotate.conf.

Some packages take special care to preserve user configuration changes, as explained in their man pages. logrotate is not such a package.

The packaging system has been known to warn that it's about to replace a user-modified configuration file and offer choices (Replace the file, Do not replace the file, Diff the old and new files, Open a shell), but this might depend on the packager marking the file as "configuration".

A System Administration way of maintaining your modified configuration files is to store the modified files in your own, similarly structured directory structure, e.g. $HOME/.userconfig/etc/logrotate.d/nginx.conf, and write a simple script to copy the files from $HOME/.userconfig/ to the system. Run this script after you update the packages.

Beware! If the package changelog says "We changed/improved the configuration file format", stuff may break.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.