LoginSignup
4
1

More than 3 years have passed since last update.

cronologの-Sオプションはもう使えない

Last updated at Posted at 2019-09-11

はじめに

apacheのログローテートをcronologを使って設定していたのですが、-Sオプションを指定した場合にシンボリックリンクが更新されないことが分かりました。

調べた結果、特定gccバージョンだと-Sオプションは機能しなくなっているようでした。
今後どうなるか分かりませんが、cronolog自体全くメンテナンスされていないため、利用するかは検討したほうが良さそうです。

検証環境

OS
18.04.2 LTS (Bionic Beaver)
GCC
7
cronologバージョン
1.6.2
apacheバージョン
2.4.29

※ -Sオプションが問題なく動いた環境は以下
OS
16.04.3 LTS (Xenial Xerus)
GCC
5.4.0
cronologバージョン
1.6.2
apacheバージョン
2.4.18

確認したこと

apacheの設定でcronolog経由でのログ出力を設定する

CustomLog     "|/usr/bin/cronolog -S ${APACHE_LOG_DIR}/access.latest.log ${APACHE_LOG_DIR}/access.%Y%m%d.log" combined

数日後、ログの出力を確認

$ ls -ltr

lrwxrwxrwx 1 root root     56 Jul 12 17:07 access.latest.log -> ${APACHE_LOG_DIR}/access.20190712.log
-rw-rw-r-- 1 root root  75044 Jul 12 23:01 access.20190712.log
-rw-rw-r-- 1 root root    441 Jul 13 00:28 access.20190713.log
-rw-rw-r-- 1 root root   4190 Jul 16 20:35 access.20190716.log
-rw-rw-r-- 1 root root   8595 Jul 17 23:56 access.20190717.log
-rw-rw-r-- 1 root root  41455 Jul 18 23:56 access.20190718.log
-rw-rw-r-- 1 root root  39456 Jul 19 23:56 access.20190719.log
-rw-rw-r-- 1 root root  39456 Jul 20 23:56 access.20190720.log

access.latest.logのシンボリックリンクが最初に作成されたまま、更新されていない。

回避策

修正はされていないが有志によりパッチが作成されているため、それを適用することで回避可能(すみません私は適用確認できていません)。

参考

https://github.com/fordmason/cronolog/issues/4
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1770676
https://blog.1q77.com/2013/05/cronolog-bug/

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1