Score:0

PostgreSQL Log Rotation Size Reached File Limit

de flag

I have configured the following settings in PostgreSQL 13 on Windows.

logging_collector = on  
log_rotation_size='100MB'
log_truncate_on_rotation = on    
log_filename ='postgresql-%Y-%m-%d.log'

I have configured PostgreSQL to create a daily log. Is it possible for PostgreSQL to create another file (with the configured file name) and rename the existing file by appending with a different file name when the file reaches its configured log_rotation_size?

Do I have to run some script or services on the background so that the program is able to monitor the data/logs folder and rename the file when the log file size reaches the limit?

Score:0
br flag

On Linux you would have PostgreSQL create a log with a simple name (such as postgresql.log) and then configure logrotate to manage the PostgreSQL log, rotating and deleting it as you require.

Information to support this (though not telling you how to do this) is in the PostgreSQL docs section on log file maintenance.

However, on Windows you (probably) won't have this option, so how the file is rotated is up to you, whether by a script or some other utility.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.