Monthly Log Rotations With PostgreSQL's Built in Logging

Today on [ IRC] I was trying to figure out a way to set up monthly log rotation using PostgreSQL’s [ built in logging] system, and what we came up with was the following:
log_filename = 'postgresql-%Y-%m.log' log_truncate_on_rotation = off log_rotation_age = 1d
This will name the log files by year and month, will append to existing logfiles if they exist, and will attempt log rotation every day. This works fine for a monthly log rotation, since all of the days in April will want to use postgresql-2007-04.log, while May 1st will start writing into postgresql-2007-05.log. Thanks to oicu for help researching, with special hat tip to AndrewSN who guessed the right solution. I verified it by running the above setup but using an hourly rotation and 10 minute timeouts.