Jump to content

Recommended Posts

Posted

One of my Armbian machines (24.5.5 bookworm) is running PostgreSQL.  I don't think I've changed any of its default settings relating to PostgreSQL's log files or their permissions, but I'm occasionally getting emails from the armbian-truncate-logs cron job saying:

Quote

truncate: cannot open '/var/log/postgresql/postgresql-15-main.log' for writing: Permission denied

The directory /var/log/postgresql is owned by root (and group postgres) and has permissions drwxrwxr-t, and the file /var/log/postgresql/postgresql-15-main.log is owned by postgres (and group adm) and has permissions -rw-r-----.

 

In /var/log.hdd/postgresql the ownership and permissions are the same, and there are also files postgresql-15-main.log.1, postgresql-15-main.log.2.gz, postgresql-15-main.log.3.gz, ..., postgresql-15-main.log.10.gz (with the same ownership and permissions as postgresql-15-main.log).  The file postgresql-15-main.log.1 is a prefix of postgresql-15-main.log.

 

I have this problem only with PostgreSQL's logs; armbian-truncate-logs doesn't complain about any other log files.

 

Is there something I need to do to fix this, or is this a bug that will be fixed in future?

Posted

I seem to have successfully worked around this problem by changing the permissions on /var/log/postgresql.  I'm not sure why the cron job, which looks like it's set up to run as root, couldn't truncate the file in that folder; and I'm not sure whether my solution is durable, or whether a reboot or something might reset the permissions at some stage, but it works for now.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines