To configure log rotation for your endpoints you should run do as follows:
Configure Zypper Logrotate for SUSE:
For SUSE endpoints, there is a logrotate built-in utility. Hence, the only thing needs to be done is to change the existing configuration (for help with Zypper check here):
1. Connect to SUSE endpoint
2. go to /etc/logrotate.d
3. Edit the folder zypper.lr:
vi /etc/logrotate.d/zypper.lr
Update the configuration to match the following:
- maxage stores 7 days of logs
- rotate indicates that only 10 rotated logs should be kept. Thus, the oldest file will be removed on the 11th subsequent run.
- size sets the minimum size for the rotation to take place to 10M. In other words, each log will not be rotated until it reaches 10MB.
4. Repeat step 3 for folders zypp-history.lr and zypp-refresh.lr
5. Restart endpoint
Configure yum Logrotate
This configuration is relevant for the following operating systems:
- RHEL 6/7
- CentOS 6/7
- Amazon Linux
- Oracle Linux
If logrotate is not yet installed on your endpoint run :
yum install logrotate
After you have installed logrotate, please complete the following steps:
1. Edit the yum file:
vi /etc/logrotate.d/yum
2. Update the configuration to match the following:
{ weekly rotate 3 size 10M compress delaycompress }
- weekly means that the tool will attempt to rotate the logs on a weekly basis. Other possible values are daily and monthly.
- rotate 3 indicates that only 3 rotated logs should be kept. Thus, the oldest file will be removed on the fourth subsequent run.
- size=10M sets the minimum size for the rotation to take place to 10M. In other words, each log will not be rotated until it reaches 10MB.
- compress and delaycompress are used to tell that all rotated logs, with the exception of the most recent one, should be compressed.
3. Restart endpoint
Comments
0 comments
Please sign in to leave a comment.