Container
•
•
By Richard
容器日誌處理:Stdout vs. File Logging
12-Factor App 原則
容器化應用應將日誌輸出至 Stdout/Stderr,而非寫入容器內檔案。
這樣做的好處是讓 K8s 節點級的 Log Agent (如 DaemonSet 運行的 Fluent Bit) 能統一收集 /var/log/containers/*.log,而無需侵入容器內部。這也避免了容器內 Log 檔案未輪替 (Rotate) 導致磁碟爆滿的風險。