In postgresql, I'm using the following configuration to maintain my weekly logs:

log_truncate_on_rotation = on
log_rotation_age = 1d
log_filename = 'postgresql-%a.log'
log_rotation_size = 0  #just rotate daily

This creates a log file with a name like 'postgresql-Mon.log' and when rotation occurs, it overrides the old file with the same name. This way I'm able to maintain a weekly log.

I now want to move this configuration to keeping the log for just one day, instead of 7 days. How do you suggest I tweak the config given above to achieve this? Do I only need to change the log_filename to postgresql.log? Please advise. Thanks in advance.

1 Answer 1


Yes, as (like you described) rotation replaces the file with the same name, you can find whichever name you like, without any daily changing bits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.