Rate This Document
Findability
Accuracy
Completeness
Readability

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 consists log file management parameters of EC Turbo. This file is installed in a specified directory when EC Turbo is installed. It has the following content:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/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.
  1. Add the cron_sdslog file to /etc/cron.d/. The file content is as follows:
    1
    */1 * * * * root /usr/sbin/logrotate /etc/logrotate_sdslog.conf
    
  2. Change the permission on cron_sdslog file to 600.