* [bug#45588] [PATCH] services: postgresql: Log from pg_ctl.
@ 2021-01-01 10:10 Christopher Baines
2021-01-06 9:22 ` Mathieu Othacehe
2021-02-22 22:30 ` bug#45588: " Christopher Baines
0 siblings, 2 replies; 4+ messages in thread
From: Christopher Baines @ 2021-01-01 10:10 UTC (permalink / raw)
To: 45588
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#45588] [PATCH] services: postgresql: Log from pg_ctl.
2021-01-01 10:10 [bug#45588] [PATCH] services: postgresql: Log from pg_ctl Christopher Baines
@ 2021-01-06 9:22 ` Mathieu Othacehe
2021-01-14 13:51 ` Mathieu Othacehe
2021-02-22 22:30 ` bug#45588: " Christopher Baines
1 sibling, 1 reply; 4+ messages in thread
From: Mathieu Othacehe @ 2021-01-06 9:22 UTC (permalink / raw)
To: Christopher Baines; +Cc: 45588
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#45588: [PATCH] services: postgresql: Log from pg_ctl.
2021-01-01 10:10 [bug#45588] [PATCH] services: postgresql: Log from pg_ctl Christopher Baines
2021-01-06 9:22 ` Mathieu Othacehe
@ 2021-02-22 22:30 ` Christopher Baines
1 sibling, 0 replies; 4+ messages in thread
From: Christopher Baines @ 2021-02-22 22:30 UTC (permalink / raw)
To: 45588-close
Christopher Baines <mail@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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-22 22:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-01 10:10 [bug#45588] [PATCH] services: postgresql: Log from pg_ctl Christopher Baines
2021-01-06 9:22 ` Mathieu Othacehe
2021-01-14 13:51 ` Mathieu Othacehe
2021-02-22 22:30 ` bug#45588: " Christopher Baines
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.