diff --git a/debian/docs/koha-common.xml b/debian/docs/koha-common.xml index 99a00c559f..d8522861ab 100644 --- a/debian/docs/koha-common.xml +++ b/debian/docs/koha-common.xml @@ -31,7 +31,7 @@ - The default on systemd hosts. Every daemon of every instance is its own unit: koha-plack@INSTANCE.service, koha-zebra@INSTANCE.service, koha-indexer@INSTANCE.service, koha-es-indexer@INSTANCE.service, koha-worker@INSTANCE.service, koha-worker-long_tasks@INSTANCE.service, koha-sip@INSTANCE.service and koha-z3950@INSTANCE.service, grouped by koha@INSTANCE.target per instance and koha.target for the whole host. systemctl restart koha-common still restarts everything. The daemons' standard output and error go to the journal (journalctl -u koha-zebra@INSTANCE); see /usr/share/doc/koha-systemd/README.Debian. + The default on systemd hosts. Every daemon of every instance is its own unit: koha-plack@INSTANCE.service, koha-zebra@INSTANCE.service, koha-indexer@INSTANCE.service, koha-es-indexer@INSTANCE.service, koha-worker@INSTANCE.service, koha-worker-long_tasks@INSTANCE.service, koha-sip@INSTANCE.service and koha-z3950@INSTANCE.service, grouped by koha@INSTANCE.target per instance and koha.target for the whole host. systemctl restart koha-common still restarts everything. Each daemon's standard output and error are captured to the same /var/log/koha/INSTANCE/NAME-output.log and NAME-error.log files as with koha-sysv; systemd's own messages about a unit are in the journal (journalctl -u koha-zebra@INSTANCE). See /usr/share/doc/koha-systemd/README.Debian. diff --git a/debian/koha-systemd.NEWS b/debian/koha-systemd.NEWS index 66f0271711..4693981f38 100644 --- a/debian/koha-systemd.NEWS +++ b/debian/koha-systemd.NEWS @@ -15,12 +15,11 @@ koha (26.06.00~1) unstable; urgency=medium "systemctl restart koha-common" still restarts everything, and the koha-plack/koha-zebra/koha-worker/... helpers work as before. - * Daemon stdout/stderr goes to the journal, not to - /var/log/koha/INSTANCE/NAME-output.log and NAME-error.log. Use - "journalctl -u koha-zebra@INSTANCE" (or -t INSTANCE-koha-zebra). - Logs written by Koha itself (plack.log, plack-error.log, the log4perl - files such as plack-opac-error.log, sip-output.log, z3950.log) are - unchanged. + * Log files are unchanged: each daemon's stdout/stderr still lands in + /var/log/koha/INSTANCE/NAME-output.log and NAME-error.log, and the + files Koha writes itself (plack.log, the log4perl files, z3950.log) + are untouched. The journal holds systemd's own messages about each + unit ("journalctl -u koha-zebra@INSTANCE" shows why one failed). * The units are sandboxed (PrivateTmp, ProtectSystem=full, ProtectHome, NoNewPrivileges). Instances whose koha-conf.xml has an empty diff --git a/debian/koha-systemd.README.Debian b/debian/koha-systemd.README.Debian index 1af8c8058a..21288a0f81 100644 --- a/debian/koha-systemd.README.Debian +++ b/debian/koha-systemd.README.Debian @@ -88,29 +88,14 @@ unit after changing them. ## Logging -This is the one visible difference from the init script. With koha-sysv the -daemon(1) wrapper captured each daemon's standard output and error to -/var/log/koha/INSTANCE/NAME-output.log and NAME-error.log. With systemd -that output goes to the journal instead: - - journalctl -u koha-zebra@library.service - journalctl -t library-koha-worker # by SyslogIdentifier - journalctl -u 'koha-*@library.service' # everything for one instance - -So on a koha-systemd host these files are no longer written: - - zebra-output.log, zebra-error.log - indexer-output.log, indexer-error.log - es-indexer-output.log, es-indexer-error.log - worker-output.log, worker-error.log (the worker's log4perl appender - writes to stderr, so its messages - are in the journal too) - sip-error.log (SIP's own log4perl output still - goes to sip-output.log) - -Everything the application writes itself is unchanged, because it is -configured in /etc/koha/sites/INSTANCE/log4perl.conf or passed on the -command line, not captured from stdout: +Log locations are the same with either init package. With koha-sysv the +daemon(1) wrapper captures each daemon's standard output and error to +/var/log/koha/INSTANCE/NAME-output.log and NAME-error.log; the systemd +units do the same through StandardOutput=append: and StandardError=append:, +so zebra-*.log, indexer-*.log, es-indexer-*.log, worker-*.log and +sip-*.log keep being written where they always were and the shipped +logrotate configuration keeps rotating them. Everything Koha writes itself +is unaffected either way: plack.log, plack-error.log (Starman --access-log/--error-log) plack-opac-error.log, plack-intranet-error.log, plack-api-error.log, @@ -120,8 +105,20 @@ command line, not captured from stdout: opac-error.log, intranet-error.log, opac-access.log, ... (Apache, per vhost) -Existing NAME-output.log/NAME-error.log files are left in place; logrotate -keeps rotating whatever is there. +The journal therefore only holds what systemd itself records about a unit +(starts, stops, failures, restart-limit hits), which is where to look when +a unit refuses to start: + + journalctl -u koha-zebra@library.service + journalctl -u 'koha-*@library.service' # everything for one instance + +If you would rather have a daemon's output in the journal, override the two +directives with a drop-in: + + systemctl edit koha-worker@library.service + [Service] + StandardOutput=journal + StandardError=journal ## Sandboxing diff --git a/debian/systemd/koha-es-indexer@.service b/debian/systemd/koha-es-indexer@.service index 1de5c6bc7c..bfc7857eed 100644 --- a/debian/systemd/koha-es-indexer@.service +++ b/debian/systemd/koha-es-indexer@.service @@ -13,6 +13,10 @@ Type=simple User=%i-koha Group=%i-koha SyslogIdentifier=%i-koha-es-indexer +# Capture stdout/stderr to the same files the daemon(1) wrapper used under +# SysV, so log locations are identical whichever init package is installed. +StandardOutput=append:/var/log/koha/%i/es-indexer-output.log +StandardError=append:/var/log/koha/%i/es-indexer-error.log WorkingDirectory=/var/lib/koha/%i Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml Environment=KOHA_HOME=/usr/share/koha diff --git a/debian/systemd/koha-indexer@.service b/debian/systemd/koha-indexer@.service index 0bc9f92e7e..9f1c59d4e8 100644 --- a/debian/systemd/koha-indexer@.service +++ b/debian/systemd/koha-indexer@.service @@ -13,6 +13,10 @@ Type=simple User=%i-koha Group=%i-koha SyslogIdentifier=%i-koha-indexer +# Capture stdout/stderr to the same files the daemon(1) wrapper used under +# SysV, so log locations are identical whichever init package is installed. +StandardOutput=append:/var/log/koha/%i/indexer-output.log +StandardError=append:/var/log/koha/%i/indexer-error.log WorkingDirectory=/var/lib/koha/%i Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml Environment=KOHA_HOME=/usr/share/koha diff --git a/debian/systemd/koha-sip@.service b/debian/systemd/koha-sip@.service index bc3c73bafe..959fa32cbc 100644 --- a/debian/systemd/koha-sip@.service +++ b/debian/systemd/koha-sip@.service @@ -15,6 +15,10 @@ Type=simple User=%i-koha Group=%i-koha SyslogIdentifier=%i-koha-sip +# Capture stdout/stderr to the same files the daemon(1) wrapper used under +# SysV, so log locations are identical whichever init package is installed. +StandardOutput=append:/var/log/koha/%i/sip-output.log +StandardError=append:/var/log/koha/%i/sip-error.log WorkingDirectory=/var/lib/koha/%i Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml Environment=KOHA_HOME=/usr/share/koha diff --git a/debian/systemd/koha-worker-long_tasks@.service b/debian/systemd/koha-worker-long_tasks@.service index b4024e2732..cd05398318 100644 --- a/debian/systemd/koha-worker-long_tasks@.service +++ b/debian/systemd/koha-worker-long_tasks@.service @@ -13,6 +13,10 @@ Type=simple User=%i-koha Group=%i-koha SyslogIdentifier=%i-koha-worker-long_tasks +# Capture stdout/stderr to the same files the daemon(1) wrapper used under +# SysV, so log locations are identical whichever init package is installed. +StandardOutput=append:/var/log/koha/%i/worker-output.log +StandardError=append:/var/log/koha/%i/worker-error.log WorkingDirectory=/var/lib/koha/%i Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml Environment=KOHA_HOME=/usr/share/koha diff --git a/debian/systemd/koha-worker@.service b/debian/systemd/koha-worker@.service index 25d8ddd5ca..043810ab46 100644 --- a/debian/systemd/koha-worker@.service +++ b/debian/systemd/koha-worker@.service @@ -13,6 +13,10 @@ Type=simple User=%i-koha Group=%i-koha SyslogIdentifier=%i-koha-worker +# Capture stdout/stderr to the same files the daemon(1) wrapper used under +# SysV, so log locations are identical whichever init package is installed. +StandardOutput=append:/var/log/koha/%i/worker-output.log +StandardError=append:/var/log/koha/%i/worker-error.log WorkingDirectory=/var/lib/koha/%i Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml Environment=KOHA_HOME=/usr/share/koha diff --git a/debian/systemd/koha-zebra@.service b/debian/systemd/koha-zebra@.service index afe8bd3759..f19e2d58f3 100644 --- a/debian/systemd/koha-zebra@.service +++ b/debian/systemd/koha-zebra@.service @@ -13,6 +13,10 @@ Type=forking User=%i-koha Group=%i-koha SyslogIdentifier=%i-koha-zebra +# Capture stdout/stderr to the same files the daemon(1) wrapper used under +# SysV, so log locations are identical whichever init package is installed. +StandardOutput=append:/var/log/koha/%i/zebra-output.log +StandardError=append:/var/log/koha/%i/zebra-error.log WorkingDirectory=/var/lib/koha/%i Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml Environment=KOHA_HOME=/usr/share/koha