Posts

Showing posts from July, 2015

How to implement Log File Rotation in Linux Servers

NB: We are using CentOS Servers Switch to root user cd /etc/logrotate.d/  (by default we will be having this directory in our server) create a new file project-logs   vi project-logs Add the following piece of code to this file             /folder-path-of-your-log/*.log {                size=10M                missingok                rotate 20                compress                delaycompress                notifempty                copytruncate               daily           }       5.   logrotate -f /etc/logrotate.d/        This will create new log files once the log file size reaches 10MB. NOTE:    When you first setup a daily logrotate.d entry, it will not rotate the first day . Next day onwards you can see the changes.