Re: How to change mode for cluster log?

From: Paul Förster <paul(dot)foerster(at)gmail(dot)com>
To: Binghan <binghanluc(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: How to change mode for cluster log?
Date: 2021-01-26 14:43:42
Message-ID: 82C987F7-ADE4-4907-BB98-E36550134D67@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Binghan,

> On 26. Jan, 2021, at 15:33, Binghan <binghanluc(at)gmail(dot)com> wrote:
>
> I have the following configuration in postgresql.conf. However, it only ensure the mode 600 for file under pg_log. The cluster log file postgresql-10-main.log has 640. How can control the mode for cluster log in postgres.
>
> logging_collector = off
> log_directory = '/var/log/postgresql/pg_log'
> log_filename = 'postgres-event.log'
> log_file_mode = 0600

you say, your file "postgresql-10-main.log" has 640 but your log_filename is "postgres-event.log". So the file "postgresql-10-main.log" is something else which your setup generates elsewhere.

In any event, you can enforce read/write permissions for a user only by setting its umask to 0077. Don't forget to change the permissions of your log file. The umask command does not change that!

Your should also make the setting persistent, for example in the profile of user postgres.

Cheers,
Paul

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Wells Oliver 2021-01-26 19:10:32 Re: json_build_object, numeric types, and function limits on 100 arguments
Previous Message Binghan 2021-01-26 14:33:14 How to change mode for cluster log?