# Postgresql Log rotation 在Postgresql.conf更改參數 預設路徑 ```/etc/postgresql/12/main/postgresql.conf```  log_rotation_age 設定多久輪替一次log,預設單位是分鐘,設定每天輪轉可以設定1d或1440 log_rotation_size 設定輪替log的大小,預設單位是KB 接著使用Linux的logrotate壓縮log 預設路徑:/etc/logrotate.d/ 建立一個檔案postgresql-log  daily代表每天rotate一次log rotate 10 代表保留10週 delaycompress 不要將最近的檔案壓縮,留到下一次輪替 compress 壓縮檔案 notifempty 如果log為空檔,不執行輪替 missingok 在執行log輪替時忽略錯誤
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up