KUSANAGI ログ関連

技術

最近、さくらVPSでKUSANAGIを使う機会がありました。
logrotateのデフォルト設定ファイルを残しておきます。
KUSANAGIのバージョンは8.2.1-2です。

/etc/logrotate.conf

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.


/etc/logrotate.d/bootlog

/var/log/boot.log
{
    missingok
    daily
    copytruncate
    rotate 7
    notifempty
}

/etc/logrotate.d/chrony

/var/log/chrony/*.log {
    missingok
    nocreate
    sharedscripts
    postrotate
        /usr/bin/chronyc cyclelogs > /dev/null 2>&1 || true
    endscript
}

/etc/logrotate.d/fail2ban

#
# Gentoo:
# http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-analyzer/fail2ban/files/fail2ban-logrotate?view=markup
#
# Debian:
# https://github.com/fail2ban/fail2ban/blob/debian/debian/fail2ban.logrotate

/var/log/fail2ban.log {
    missingok
    notifempty
    postrotate
      /usr/bin/fail2ban-client flushlogs >/dev/null || true
    endscript
}

/etc/logrotate.d/hhvmd

/var/log/hhvmd/*log {
    daily
    rotate 52
    missingok
    notifempty
    compress
    delaycompress
    sharedscripts
    copytruncate
}

/etc/logrotate.d/httpd

/var/log/httpd/*log /home/kusanagi/*/log/httpd/*log {
#    create 0640 httpd www
    daily
    rotate 52
    missingok
    notifempty
    compress
    sharedscripts
    delaycompress
    postrotate
        /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
    endscript
}

/etc/logrotate.d/monit

/var/log/monit.log {
    missingok
    notifempty
    size 100k
    create 0644 root root
    postrotate
        /bin/systemctl reload monit.service > /dev/null 2>&1 || :
    endscript
}

/etc/logrotate.d/mysql

# This logname can be set in /etc/my.cnf
# by setting the variable "err-log"
# in the [safe_mysqld] section as follows:
#
# [safe_mysqld]
# err-log=/var/lib/mysql/mysqld.log
#
# If the root user has a password you have to create a
# /root/.my.cnf configuration file with the following
# content:
#
# [mysqladmin]
# password = <secret> 
# user= root
#
# where "<secret>" is the password. 
#
# ATTENTION: This /root/.my.cnf should be readable ONLY
# for root !

/var/log/mysql/mysqld.log /var/log/mysql/slow.log {
    # create 600 mysql mysql
    notifempty
    daily
    rotate 52
    missingok
    compress
    delaycompress
    postrotate
    # just if mysqld is really running
    if test -x /usr/bin/mysqladmin && \
       /usr/bin/mysqladmin ping &>/dev/null
    then
       /usr/bin/mysqladmin --defaults-extra-file=/root/.my.cnf flush-logs
    fi
    endscript
}

/etc/logrotate.d/lsyncd

/var/log/lsyncd/*log {
    missingok
    notifempty
    sharedscripts
}

/etc/logrotate.d/nginx

/var/log/nginx/*.log /home/kusanagi/*/log/nginx/*.log {
        daily
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        sharedscripts
        postrotate
                [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid`
        endscript
}

/etc/logrotate.d/php-fpm

/var/log/php-fpm/*log {
    daily
    rotate 52
    missingok
    notifempty
    sharedscripts
    compress
    delaycompress
    postrotate
    /bin/kill -SIGUSR1 `cat /run/php-fpm/php-fpm.pid 2>/dev/null` 2>/dev/null || true
    endscript
}

/etc/logrotate.d/ppp

# Logrotate file for ppp RPM

/var/log/ppp/connect-errors {
    missingok
    compress
    notifempty
    daily
    rotate 5
    create 0600 root root
}

/etc/logrotate.d/psacct

# Logrotate file for psacct RPM

/var/account/pacct {
    compress
    delaycompress
    notifempty
    daily
    rotate 31
    create 0600 root root
    postrotate
       if /usr/bin/systemctl --quiet is-active psacct.service ; then
           /usr/sbin/accton /var/account/pacct | /usr/bin/grep -v "Turning on process accounting, file set to '/var/account/pacct'." | /usr/bin/cat
       fi
    endscript
}

/etc/logrotate.d/syslog

/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
    missingok
    sharedscripts
    postrotate
    /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

/etc/logrotate.d/vsftpd

/var/log/vsftpd.log {
    # ftpd doesn't handle SIGHUP properly
    nocompress
    missingok
}

/var/log/xferlog {
    # ftpd doesn't handle SIGHUP properly
    nocompress
    missingok
}

/etc/logrotate.d/wpa_supplicant

/var/log/wpa_supplicant.log {
    missingok
    notifempty
    size 30k
    create 0600 root root
}

/etc/logrotate.d/zabbix-agent

/var/log/zabbix/zabbix_agentd.log {
    weekly
    rotate 12
    compress
    delaycompress
    missingok
    notifempty
    create 0664 zabbix zabbix
}

/etc/logrotate.d/yum

/var/log/yum.log {
    missingok
    notifempty
    size 30k
    yearly
    create 0600 root root
}

コメント

タイトルとURLをコピーしました