Working on a friends server earlier this morning I noticed that he had logrotate configured but he did not have a configuration file for Postfix. Below is the quick one I whipped up for his environment including a brief explanation of each line of the configuration file below the script. Following the explanation of the various configurations is the command to actually force logrotate to run in debug mode so you can see what happens.
If you have the resources (CPU + RAM) available on your server then its can be a great troubleshooting tool if you enable MySQL logging which includes server messages, SQL query logs, and slow query logs. If you do not have the resources I would suggest only enable minimal logging such as only server messages and the slow query log since enabling all queries to be written to a file can become expensive rather quickly. Below I discuss enabling three different types of MySQL logging, adding a MySQL configuration file to logrotate, and configuring root to run mysqladmin commands without having to type the password out each time.
Setting up log rotation for multiple Ruby on Rails projects on the same Linux server is easy using logrotate. If all of your projects are in the same directory structure it is even easier by using variables to work for each different project as explained below in detail.
First you will need to install logrotate which can be installed on CentOS Linux via yum as shown in the below command.
- yum install logrotate