skip to Main Content

On a Ubuntu 20.04 and Postgresql 12 I’m getting in charged of, I’m finding that the /var/log/postgresql directory keeps getting bloated with a postgresql.log file containing every single event, action, query, connection, and it’s obviously getting huge.
The usual logrotate daemon is trying to keep it rotated and compressed, but that’s obviously not legit to put such a load on logrotate.

As I know very little about pgsql, the only option I found relevant was to uncomment from /etc/postgresql/12/main/postgresql.conf the option :
log_statement = ‘none’
for which I had little hope, as it seems to be the default value.

After a process restart and no long wait, the log file keeps growing.

In this postgresql.conf file, every directive related to logging is disabled.
I also paid attention to the actual conf file the pg process was using, and it’s the relevant one.

So I’m here to ask whether there are other conf files that could override this directive, and where they are. And maybe if there could be directives defined inside pgsql internals I could check and change?

Thank you.

2

Answers


  1. Chosen as BEST ANSWER

    About settings, here is what I find about logging :

    $ psql
    psql (12.16 (Ubuntu 12.16-0ubuntu0.20.04.1)) Type "help" for
    help.
     
    postgres=# SHOW log_statement;
     log_statement
    ---------------
     none
    (1 row)
    

  2. but that's obviously not legit – logrotate rotating your logfiles is bad in some way? That’s it’s job.

    If PostgreSQL is logging all statements then that has been configured somewhere. You can SHOW <setting> for any configuration setting in psql.

    Clearly it isn’t set in the file you’ve looked in though. There are options to include other config files from the main one of course – check for "Include" mentioned somewhere.

    When hitting problems like this, I find that taking a few minutes to read the manuals can be helpful:

    https://www.postgresql.org/docs/current/config-setting.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search