mattintosh note

EasyWine died.

logrotate で複数ファイルの指定

ワイルドカード使えるは知ってるけど複数パス同時指定できるかどうか知らなかったので。単純にスペースとか改行とかで区切ればいいようだ。

/tmp/access.log
/tmp/access_custom.log
/tmp/cache.log
{
    weekly
    compress
    compresscmd /bin/bzip2
    missingok
    rotate 3
    postrotate
    killall -HUP /opt/local/squid/sbin/squid
    endscript
}

logrotate のオプションを確認。

Usage: logrotate [OPTION...] <configfile>
  -d, --debug               Don't do anything, just test (implies -v)
  -f, --force               Force file rotation
  -m, --mail=command        Command to send mail (instead of `/usr/bin/mail')
  -s, --state=statefile     Path of state file
  -v, --verbose             Display messages during rotation
  -l, --log=STRING          Log file or 'syslog' to log to syslog
      --version             Display version information

Help options:
  -?, --help                Show this help message
      --usage               Display brief usage message

-dデバッグオプションを付けてチェック。

logrotate -d -f /etc/logrotate.d/squid

ログを見ると considering log で3つ出てくる。

:
中略
:
rotating pattern: /tmp/access.log
/tmp/access_custom.log
/tmp/cache.log
 weekly (3 rotations)
empty log files are rotated, old logs are removed
considering log /tmp/access.log
Creating new state
  Now: 2019-07-09 15:57
  Last rotated at 2019-07-09 15:00
  log does not need rotating (log has been already rotated)
considering log /tmp/access_custom.log
Creating new state
  Now: 2019-07-09 15:57
  Last rotated at 2019-07-09 15:00
  log does not need rotating (log has been already rotated)
considering log /tmp/cache.log
Creating new state
  Now: 2019-07-09 15:57
  Last rotated at 2019-07-09 15:00
  log does not need rotating (log has been already rotated)

以上