Thread: Systemd vs logging collector
In Arch Linux, Postgres is started by systemd. If you configure logging_collector in postgresql.conf this has no effect.All of the logging output is send to the journal, where you can read it with “journalctl -u postgresql”. The configuration for systemd contains a StandardError option. I’ve tried various settings but none result in a regular Postgreslog file. The Postgres settings for systemd can be found here: /usr/lib/systemd/system/postgresql.service Is there a way to let Postgres do its own logging when it is started by systemd? Kind regards, Andomar P.S. Trying to figure this out in order to answer this question: http://dba.stackexchange.com/questions/105384/postgresql-doesnt-log/
> -----Original Message----- > From: pgsql-general-owner@postgresql.org [mailto:pgsql-general- > owner@postgresql.org] On Behalf Of Andomar > Sent: Mittwoch, 1. Juli 2015 09:22 > To: pgsql-general@postgresql.org > Subject: [GENERAL] Systemd vs logging collector > > In Arch Linux, Postgres is started by systemd. If you configure > logging_collector in postgresql.conf this has no effect. All of the > logging output is send to the journal, where you can read it with > “journalctl -u postgresql”. > > The configuration for systemd contains a StandardError option. I’ve > tried various settings but none result in a regular Postgres log file. > The Postgres settings for systemd can be found here: > /usr/lib/systemd/system/postgresql.service > > Is there a way to let Postgres do its own logging when it is started by > systemd? > > Kind regards, > Andomar > > P.S. Trying to figure this out in order to answer this question: > http://dba.stackexchange.com/questions/105384/postgresql-doesnt-log/ Hello, are you just missing this parameter: #log_destination = 'stderr' # Valid values are combinations of # stderr, csvlog, syslog, and eventlog, # depending on platform. csvlog # requires logging_collector to be on. regards, Marc Mamin > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To > make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general
> are you just missing this parameter: > > #log_destination = 'stderr' # Valid values are combinations of > # stderr, csvlog, syslog, and eventlog, > # depending on platform. csvlog > # requires logging_collector to be on. > Thanks for your reply, log_destination is set to "stderr". And logging_collector is "on". On CentOS, this results in regular Postgres log files. On Arch Linux, the results end up in the system journal. It looks like the Postgres logging collector somehow misses out on the stream of messages. Kind regards, Andomar
On 07/01/2015 12:22 AM, Andomar wrote: > In Arch Linux, Postgres is started by systemd. If you configure logging_collector in postgresql.conf this has no effect.All of the logging output is send to the journal, where you can read it with “journalctl -u postgresql”. > > The configuration for systemd contains a StandardError option. I’ve tried various settings but none result in a regularPostgres log file. The Postgres settings for systemd can be found here: /usr/lib/systemd/system/postgresql.service What are they? > > Is there a way to let Postgres do its own logging when it is started by systemd? > > Kind regards, > Andomar > > P.S. Trying to figure this out in order to answer this question: http://dba.stackexchange.com/questions/105384/postgresql-doesnt-log/ > -- Adrian Klaver adrian.klaver@aklaver.com
On 07/01/2015 05:26 AM, Andomar wrote: >> are you just missing this parameter: >> >> #log_destination = 'stderr' # Valid values are >> combinations of >> # stderr, csvlog, syslog, and >> eventlog, >> # depending on platform. csvlog >> # requires logging_collector >> to be on. >> > > Thanks for your reply, log_destination is set to "stderr". And > logging_collector is "on". And you have the log_directory set up? > > On CentOS, this results in regular Postgres log files. On Arch Linux, > the results end up in the system journal. It looks like the Postgres > logging collector somehow misses out on the stream of messages. Best guess is the systemd script is catching and redirecting the output first. > > Kind regards, > Andomar > > -- Adrian Klaver adrian.klaver@aklaver.com
Andomar <andomar@aule.net> writes: > Thanks for your reply, log_destination is set to "stderr". And > logging_collector is "on". > On CentOS, this results in regular Postgres log files. On Arch Linux, > the results end up in the system journal. It looks like the Postgres > logging collector somehow misses out on the stream of messages. I'm not sure I believe that analysis. What seems more likely to me is that the user is looking in the wrong place for the log files. I see that he's got the log destination configured as "/tmp", but on at least some Linux distributions, daemons are silently redirected to some allegedly-more-secure directory if they try to access /tmp. regards, tom lane