Log files in Linux can be managed via the logrotate command (See man pages). If the log files start growing too big, it can be difficult to audit these log files.
Here is an example to create a new log file each week as the weekly cron (See man pages) service runs.
Following is an example where the cakephp application is installed. It will create a new file each week for 52 times before deleting the oldest file. Each file will be appended with a running number starting with "1". If the log file is missing, no errors will be printed/emailed and nothing will be done if the log file is empty.
Step 1: Create the configuration file
Create the file /etc/logrotate.d/cakephp with permission 644 (owned by root) and following contents;
/var/www/html/mymesyuarat/*/tmp/logs/*.log {
weekly
missingok
rotate 52
compress
dateext
delaycompress
notifempty
create 640 root root
sharedscripts
}
Step 2: Ensure that the logrotate service is running.
The above configuration can be tested with the following command;
logrotate -s /tmp/logrotatestatus /etc/logrotate/cakephp
Looking at alternative computer software solutions for a variety of reasons. This includes price, computer security, virus prevention and reliability. Here are my notes and great that if it helps you, otherwise please understand what you are doing and not follow blindly. All works expressed are my own and does not necessarily express the products or organisations mentioned here.
No comments:
Post a Comment