Enable logrotate

If you are using a virtual machine or cloud image, logrotate is already configured and enabled by default.

Locate logrotate files

Logrotate files for different servers are stored in the */opt/bitnami/config/logrotate/logrotate.d directory. For instance, to configure the Apache logrotate file, edit the file at /opt/bitnami/config/logrotate/logrotate.d/apache. Use the man logrotate command for information on all available options.

By default, logrotate uses the “copytruncate” approach so it is not necessary to restart the servers.

IMPORTANT: The “copytruncate” approach truncates the original log file to zero size in place after creating a copy, instead of moving the old log file and optionally creating a new one. There is a very small time slice between copying the file and truncating it, so some logging data might be lost. To record every request, use a different approach for rotating the logs.

Test logrotate

The command below displays the current logrotate configuration for your servers: