From 33d42e24725a8c397ad30dd6e074333e076ed690 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Wed, 23 Aug 2023 17:25:41 +0200 Subject: [PATCH] bundles/matrix-synapse: ensure we're logging to journal --- bundles/matrix-synapse/files/log.yaml | 21 +++++++++++++++++++++ bundles/matrix-synapse/items.py | 13 +++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 bundles/matrix-synapse/files/log.yaml diff --git a/bundles/matrix-synapse/files/log.yaml b/bundles/matrix-synapse/files/log.yaml new file mode 100644 index 0000000..f2bc9ff --- /dev/null +++ b/bundles/matrix-synapse/files/log.yaml @@ -0,0 +1,21 @@ +version: 1 + +formatters: + journal: + format: '%(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' + +handlers: + console: + class: logging.StreamHandler + formatter: journal + +loggers: + synapse.storage.SQL: + level: INFO + +root: + level: INFO + + handlers: [console] + +disable_existing_loggers: false diff --git a/bundles/matrix-synapse/items.py b/bundles/matrix-synapse/items.py index 172a940..527cc5e 100644 --- a/bundles/matrix-synapse/items.py +++ b/bundles/matrix-synapse/items.py @@ -1,7 +1,15 @@ files = { '/etc/matrix-synapse/homeserver.yaml': { 'content_type': 'mako', - 'context': node.metadata['matrix-synapse'], + 'context': node.metadata.get('matrix-synapse'), + 'needs': { + 'pkg_apt:matrix-synapse-py3', + }, + 'triggers': { + 'svc_systemd:matrix-synapse:restart', + }, + }, + '/etc/matrix-synapse/log.yaml': { 'needs': { 'pkg_apt:matrix-synapse-py3', }, @@ -31,7 +39,7 @@ files = { # Our override.conf ensures this file is never read, so we don't # need to restart synapse after changing stuff in here. 'content_type': 'mako', - 'context': node.metadata['matrix-synapse'], + 'context': node.metadata.get('matrix-synapse'), }, '/etc/matrix-synapse/conf.d/report_stats.yaml': { # see comment above @@ -42,6 +50,7 @@ svc_systemd = { 'matrix-synapse': { 'needs': { 'file:/etc/matrix-synapse/homeserver.yaml', + 'file:/etc/matrix-synapse/log.yaml', 'file:/etc/systemd/system/matrix-synapse.service.d/override.conf', 'pkg_apt:matrix-synapse-py3', 'postgres_db:synapse',