From unknown Thu Sep 11 17:28:35 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 01 Jan 2021 10:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45588 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45588@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160949582619381 (code B ref -1); Fri, 01 Jan 2021 10:11:01 +0000 Received: (at submit) by debbugs.gnu.org; 1 Jan 2021 10:10:26 +0000 Received: from localhost ([127.0.0.1]:55344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvHO6-00052W-2g for submit@debbugs.gnu.org; Fri, 01 Jan 2021 05:10:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:55298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvHO4-00052P-EV for submit@debbugs.gnu.org; Fri, 01 Jan 2021 05:10:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kvHO4-0008ST-9p for guix-patches@gnu.org; Fri, 01 Jan 2021 05:10:24 -0500 Received: from mira.cbaines.net ([212.71.252.8]:43206) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kvHO2-0004xL-IM for guix-patches@gnu.org; Fri, 01 Jan 2021 05:10:23 -0500 Received: from localhost (92.41.186.20.threembb.co.uk [92.41.186.20]) by mira.cbaines.net (Postfix) with ESMTPSA id 38BD427BC06 for ; Fri, 1 Jan 2021 10:10:18 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 97a7c2f7 for ; Fri, 1 Jan 2021 10:10:15 +0000 (UTC) From: Christopher Baines Date: Fri, 1 Jan 2021 10:10:15 +0000 Message-Id: <20210101101015.6524-1-mail@cbaines.net> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 From unknown Thu Sep 11 17:28:35 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Jan 2021 09:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45588 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 45588@debbugs.gnu.org Received: via spool by 45588-submit@debbugs.gnu.org id=B45588.16099249304398 (code B ref 45588); Wed, 06 Jan 2021 09:23:02 +0000 Received: (at 45588) by debbugs.gnu.org; 6 Jan 2021 09:22:10 +0000 Received: from localhost ([127.0.0.1]:43425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kx518-00018r-Ay for submit@debbugs.gnu.org; Wed, 06 Jan 2021 04:22:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kx515-00018B-Qs for 45588@debbugs.gnu.org; Wed, 06 Jan 2021 04:22:08 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56506) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kx510-0000Zu-I4; Wed, 06 Jan 2021 04:22:02 -0500 Received: from [2a01:e0a:19b:d9a0:d54b:f4e5:4687:8012] (port=42460 helo=cervin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kx510-0003vl-3P; Wed, 06 Jan 2021 04:22:02 -0500 From: Mathieu Othacehe References: <20210101101015.6524-1-mail@cbaines.net> Date: Wed, 06 Jan 2021 10:22:00 +0100 In-Reply-To: <20210101101015.6524-1-mail@cbaines.net> (Christopher Baines's message of "Fri, 1 Jan 2021 10:10:15 +0000") Message-ID: <87mtxmpghz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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 From unknown Thu Sep 11 17:28:35 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Jan 2021 13:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45588 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 45588@debbugs.gnu.org Received: via spool by 45588-submit@debbugs.gnu.org id=B45588.161063232615271 (code B ref 45588); Thu, 14 Jan 2021 13:53:01 +0000 Received: (at 45588) by debbugs.gnu.org; 14 Jan 2021 13:52:06 +0000 Received: from localhost ([127.0.0.1]:37529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l032j-0003yF-QB for submit@debbugs.gnu.org; Thu, 14 Jan 2021 08:52:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l032h-0003xY-U3 for 45588@debbugs.gnu.org; Thu, 14 Jan 2021 08:52:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50724) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l032c-0003Se-MF; Thu, 14 Jan 2021 08:51:58 -0500 Received: from [2a01:e0a:19b:d9a0:1538:87ab:3a95:7600] (port=54058 helo=cervin) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l032b-0003L1-S4; Thu, 14 Jan 2021 08:51:58 -0500 From: Mathieu Othacehe References: <20210101101015.6524-1-mail@cbaines.net> <87mtxmpghz.fsf@gnu.org> Date: Thu, 14 Jan 2021 14:51:56 +0100 In-Reply-To: <87mtxmpghz.fsf@gnu.org> (Mathieu Othacehe's message of "Wed, 06 Jan 2021 10:22:00 +0100") Message-ID: <87a6tb4oeb.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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 From unknown Thu Sep 11 17:28:35 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Christopher Baines Subject: bug#45588: closed (Re: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl.) Message-ID: References: <878s7fn3a5.fsf@cbaines.net> <20210101101015.6524-1-mail@cbaines.net> X-Gnu-PR-Message: they-closed 45588 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 45588@debbugs.gnu.org Date: Mon, 22 Feb 2021 22:32:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1614033122-25907-1" This is a multi-part message in MIME format... ------------=_1614033122-25907-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45588: [PATCH] services: postgresql: Log from pg_ctl. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45588@debbugs.gnu.org. --=20 45588: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45588 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1614033122-25907-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45588-close) by debbugs.gnu.org; 22 Feb 2021 22:31:03 +0000 Received: from localhost ([127.0.0.1]:57859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEJjK-0006ih-TN for submit@debbugs.gnu.org; Mon, 22 Feb 2021 17:31:03 -0500 Received: from mira.cbaines.net ([212.71.252.8]:44984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEJjJ-0006iH-2s for 45588-close@debbugs.gnu.org; Mon, 22 Feb 2021 17:31:01 -0500 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 01B1A27BC48 for <45588-close@debbugs.gnu.org>; Mon, 22 Feb 2021 22:30:58 +0000 (GMT) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id da75f4bd for <45588-close@debbugs.gnu.org>; Mon, 22 Feb 2021 22:30:58 +0000 (UTC) References: <20210101101015.6524-1-mail@cbaines.net> User-agent: mu4e 1.4.14; emacs 27.1 From: Christopher Baines To: 45588-close@debbugs.gnu.org Subject: Re: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl. In-reply-to: <20210101101015.6524-1-mail@cbaines.net> Date: Mon, 22 Feb 2021 22:30:58 +0000 Message-ID: <878s7fn3a5.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 45588-close X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Christopher Baines 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 ------------=_1614033122-25907-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 1 Jan 2021 10:10:26 +0000 Received: from localhost ([127.0.0.1]:55344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvHO6-00052W-2g for submit@debbugs.gnu.org; Fri, 01 Jan 2021 05:10:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:55298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvHO4-00052P-EV for submit@debbugs.gnu.org; Fri, 01 Jan 2021 05:10:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kvHO4-0008ST-9p for guix-patches@gnu.org; Fri, 01 Jan 2021 05:10:24 -0500 Received: from mira.cbaines.net ([212.71.252.8]:43206) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kvHO2-0004xL-IM for guix-patches@gnu.org; Fri, 01 Jan 2021 05:10:23 -0500 Received: from localhost (92.41.186.20.threembb.co.uk [92.41.186.20]) by mira.cbaines.net (Postfix) with ESMTPSA id 38BD427BC06 for ; Fri, 1 Jan 2021 10:10:18 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 97a7c2f7 for ; Fri, 1 Jan 2021 10:10:15 +0000 (UTC) From: Christopher Baines To: guix-patches@gnu.org Subject: [PATCH] services: postgresql: Log from pg_ctl. Date: Fri, 1 Jan 2021 10:10:15 +0000 Message-Id: <20210101101015.6524-1-mail@cbaines.net> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 ------------=_1614033122-25907-1--