Managing Logs
Use logrotate and crontab to manage logs.
Logrotate is a common log management program on Linux, and crontab is a time-based task management system.
/etc/logrotate_sdslog.conf is a log file management parameter of EC Turbo. This file is installed in the specified directory when EC Turbo is installed. It has the following content:
/var/log/ceph/kpsec*.log {
rotate 30
daily
compress
dateext
dateformat.%Y%m%d.%s
size=100M
missingok
su ceph ceph
lastaction
/usr/bin/chmod 440 /var/log/ceph/kpsec*.gz
/usr/bin/chmod 440 /var/log/ceph/kpsec*.log-*
/usr/bin/chmod 440 /var/log/ceph/kpsec*.log.*
endscript
}
/var/log/sdslog*.log {
rotate 30
daily
compress
dateext
dateformat.%Y%m%d.%s
size=100M
missingok
su ceph ceph
lastaction
/usr/bin/chmod 440 /var/log/sdslog*.gz
/usr/bin/chmod 440 /var/log/sdslog*.log-*
/usr/bin/chmod 440 /var/log/sdslog*.log.*
endscript
}
Crontab can run a specified task at a fixed time, on a fixed date, or at a fixed interval. Add a task to crontab for logrotate to be executed every minute. Perform the following operations on the kps-sdslog installation package:
- Add the cron_sdslog file to /etc/cron.d/. It has the following content:
*/1 * * * * root /usr/sbin/logrotate /etc/logrotate_sdslog.conf
- Change the permission on cron_sdslog file to 600.
Parent topic: Usage Guide