在 Redhat Enterprise Linux 5 中備份記錄檔

在 Redhat Enterprise Linux 5 中備份記錄檔

大家好/女士們,

我該如何備份 var/log 檔案/資料夾?

  • 日誌檔案/資料夾變更(日誌更新)應自動從原始日誌檔案/資料夾更新為重複檔案/資料夾。

答案1

如果我明白您需要什麼,那麼最簡單的事情可能就是在 /etc/syslog.conf 中指定多個保存位置,例如 syslog 手冊頁中的範例。

#Kernel messages are first, stored in the kernel file, critical messages and higher ones also go to another host and to the console

kern.*                       /var/adm/kernel
kern.crit                    @finlandia
kern.crit                    /dev/console
kern.info;kern.!err          /var/adm/kernel-info

如您所見,每個核心訊息都儲存在 /var/adm/kernel 中,並且每個關鍵核心訊息都會發送到機器「finlandia」上的日誌伺服器並顯示在控制台上。您必須在 /etc/logrotate.d/syslog 中編輯 logrotate,以便日誌能夠在備份分割區上正確輪調。

我相信這是比使用 cron 備份更好的解決方案,因為創建了備份日誌每次記錄了一些內容:-)

無論如何,如果您有興趣在遠端電腦上建立備份日誌伺服器,我建議NSA RHEL 安全指南。第66頁。

答案2

那麼您只想保留一個備份而不是不同時間點的多個備份?最簡單的方法應該是使用rsyncincrontab讓檔案每 x 分鐘/小時/天同步到另一個資料夾。

相關內容