Docker Apache2 要做 logrotate 失敗解法

在 Linux 跑 Docker 要對 Apache 的 Log 做 logrotate,會遇到 Apache 沒有 reload 的問題

  • 註:會看到 logrotate 有執行,但是 Log 檔持續寫 access.log.1,若 Apache reload 成功,應該要寫 access.log

閱讀全文〈Docker Apache2 要做 logrotate 失敗解法〉

目錄權限修改造成 Logrotate 失敗的修復步驟

Log (/var/log/apache2) 的資料夾權限變更,造成 Logrotate 的時候無法 rotation,錯誤訊息如下:

error: skipping "/var/log/apache2/access.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

要如何修正此問題呢?

註:Logrotate 的權限一定是夠,所以不是權限不夠的問題。

閱讀全文〈目錄權限修改造成 Logrotate 失敗的修復步驟〉

Apache Log Rotation 的運行方式

Apache 預設設定會每周運行 Log Rotation, 會產生如下述的檔案:

  • /var/log/apache2/access.log.1
  • /var/log/apache2/access.log.2.gz
  • /var/log/apache2/access.log.3.gz

那這 Log rotate 時, 程式做了哪些事情呢?

註: 嚴格講, 不是 Apache run Log rotate 的, 但是此篇主要只是要知道 Log rotate 時有做哪些事情就好.

閱讀全文〈Apache Log Rotation 的運行方式〉