Last-modified: 2013-02-10 (日) 23:32:53
logrotate/mysql-server

概要

私が/etc/logrotate.d/mysql-serverで使用している設定です。
logrotateの設定rsyslogの設定に依存しています。

コード

Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
-
!
 
 
 
 
 
 
-
!
-
-
|
-
|
!
|
|
!
 
 
# 30日分保持
/var/log/mysql/log
/var/log/mysql/slow.log {
    create 640 mysql adm
    sharedscripts
    postrotate
        test -x /usr/bin/mysqladmin || exit 0
 
        # If this fails, check debian.conf!
        MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
        if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then
          # Really no mysqld or rather a missing debian-sys-maint user?
          # If this occurs and is not a error please report a bug.
          if ps cax | grep -q mysqld; then
            exit 1
          fi
        else
          $MYADMIN flush-logs
        fi
    endscript
}

検証時の環境