GNU bug report logs - #45588
[PATCH] services: postgresql: Log from pg_ctl.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Fri, 1 Jan 2021 10:11:01 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45588 in the body.
You can then email your comments to 45588 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#45588; Package guix-patches. (Fri, 01 Jan 2021 10:11:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 01 Jan 2021 10:11:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] services: postgresql: Log from pg_ctl.
Date: Fri,  1 Jan 2021 10:10:15 +0000
pg_ctl will output errors when starting PostgreSQL, for example about errors
in the configuration file. Without getting pg_ctl to log to a file, I'm not
sure how to find those errors.

* gnu/services/databases.scm (postgresql-activation): Create
/var/log/postgresql.
(postgresql-shepherd-service): Pass --log=/var/log/postgresql/pg_ctl to
pg_ctl.
---
 gnu/services/databases.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index d2dc5f0da8..479a3c56f7 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -205,6 +205,10 @@ host	all	all	::1/128 	md5"))
            (mkdir-p #$data-directory)
            (chown #$data-directory (passwd:uid user) (passwd:gid user))
 
+           ;; Create log directory
+           (mkdir-p "/var/log/postgresql")
+           (chown "/var/log/postgresql" (passwd:uid user) (passwd:gid user))
+
            ;; Drop privileges and init state directory in a new
            ;; process.  Wait for it to finish before proceeding.
            (match (primitive-fork)
@@ -247,6 +251,7 @@ host	all	all	::1/128 	md5"))
                        (setgid (passwd:gid user))
                        (setuid (passwd:uid user))
                        (execl pg_ctl pg_ctl "-D" #$data-directory "-o" options
+                              "--log=/var/log/postgresql/pg_ctl"
                               mode)))))))
             (pid-file (in-vicinity data-directory "postmaster.pid"))
             (action (lambda args
-- 
2.29.2





Information forwarded to guix-patches <at> gnu.org:
bug#45588; Package guix-patches. (Wed, 06 Jan 2021 09:23:02 GMT) Full text and rfc822 format available.

Message #8 received at 45588 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 45588 <at> debbugs.gnu.org
Subject: Re: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl.
Date: Wed, 06 Jan 2021 10:22:00 +0100
Hello Chris,

> pg_ctl will output errors when starting PostgreSQL, for example about errors
> in the configuration file. Without getting pg_ctl to log to a file, I'm not
> sure how to find those errors.

On Ubuntu, I noticed that pg_ctl logs are located in
'/var/log/postgresql/postgresql-12-main.log'.

Turns out it's using a Debian wrapper called pg_ctlcluster around pg_ctl
that is setting up logging between other things.

You could maybe call the log file 'pg_ctl.log', otherwise seems fine.

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#45588; Package guix-patches. (Thu, 14 Jan 2021 13:53:01 GMT) Full text and rfc822 format available.

Message #11 received at 45588 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 45588 <at> debbugs.gnu.org
Subject: Re: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl.
Date: Thu, 14 Jan 2021 14:51:56 +0100
Hello Chris,

> You could maybe call the log file 'pg_ctl.log', otherwise seems fine.

I added what you proposed to a patch refactoring PostgreSQL service
here: https://issues.guix.gnu.org/45860.

Thanks,

Mathieu




Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Mon, 22 Feb 2021 22:32:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Mon, 22 Feb 2021 22:32:02 GMT) Full text and rfc822 format available.

Message #16 received at 45588-close <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 45588-close <at> debbugs.gnu.org
Subject: Re: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl.
Date: Mon, 22 Feb 2021 22:30:58 +0000
Christopher Baines <mail <at> cbaines.net> writes:

> pg_ctl will output errors when starting PostgreSQL, for example about errors
> in the configuration file. Without getting pg_ctl to log to a file, I'm not
> sure how to find those errors.
>
> * gnu/services/databases.scm (postgresql-activation): Create
> /var/log/postgresql.
> (postgresql-shepherd-service): Pass --log=/var/log/postgresql/pg_ctl to
> pg_ctl.
> ---
>  gnu/services/databases.scm | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
> index d2dc5f0da8..479a3c56f7 100644
> --- a/gnu/services/databases.scm
> +++ b/gnu/services/databases.scm
> @@ -205,6 +205,10 @@ host	all	all	::1/128 	md5"))
>             (mkdir-p #$data-directory)
>             (chown #$data-directory (passwd:uid user) (passwd:gid user))
>  
> +           ;; Create log directory
> +           (mkdir-p "/var/log/postgresql")
> +           (chown "/var/log/postgresql" (passwd:uid user) (passwd:gid user))
> +
>             ;; Drop privileges and init state directory in a new
>             ;; process.  Wait for it to finish before proceeding.
>             (match (primitive-fork)
> @@ -247,6 +251,7 @@ host	all	all	::1/128 	md5"))
>                         (setgid (passwd:gid user))
>                         (setuid (passwd:uid user))
>                         (execl pg_ctl pg_ctl "-D" #$data-directory "-o" options
> +                              "--log=/var/log/postgresql/pg_ctl"
>                                mode)))))))
>              (pid-file (in-vicinity data-directory "postmaster.pid"))
>              (action (lambda args

This conflicts with
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=fe4b8823505c3271fc3eacaa93c30a5cec078739




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 23 Mar 2021 11:24:59 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.