diff --git a/ansible/inventory/runa.yml b/ansible/inventory/runa.yml index 59b8bfa..ccfabbc 100644 --- a/ansible/inventory/runa.yml +++ b/ansible/inventory/runa.yml @@ -68,6 +68,7 @@ runa: - src: mtx-storage-1.lta.internal.ru.com:/srv/nfs_synapse path: /mnt mtx-syna-2.lta.internal.ru.com: + matrix_service: "synapse" nfs: mounts: - src: mtx-storage-1.lta.internal.ru.com:/srv/nfs_synapse diff --git a/ansible/roles/synapse/files/basedir/config/homeserver.yaml b/ansible/roles/synapse/files/basedir/config/homeserver.yaml index d621f8a..0454c29 100755 --- a/ansible/roles/synapse/files/basedir/config/homeserver.yaml +++ b/ansible/roles/synapse/files/basedir/config/homeserver.yaml @@ -828,7 +828,7 @@ database: # A yaml python logging config file as described by # https://docs.python.org/3.7/library/logging.config.html#configuration-dictionary-schema # -log_config: "/config/log.yaml" +log_config: "/config/log-homeserver.yaml" ## Ratelimiting ## diff --git a/ansible/roles/synapse/files/basedir/config/log-worker-federation.yaml b/ansible/roles/synapse/files/basedir/config/log-worker-federation.yaml deleted file mode 100755 index fb43179..0000000 --- a/ansible/roles/synapse/files/basedir/config/log-worker-federation.yaml +++ /dev/null @@ -1,42 +0,0 @@ -version: 1 - -formatters: - fmt: - format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s- %(message)s' - -filters: - context: - (): synapse.logging.context.LoggingContextFilter - request: "" - -handlers: - console: - class: logging.StreamHandler - formatter: fmt - filters: [context] - file: - class: logging.handlers.TimedRotatingFileHandler - formatter: fmt - filename: /logs/worker-federation.log - when: midnight - backupCount: 3 - encoding: utf8 - -root: - level: INFO - handlers: - - console - - file - -loggers: - synapse: - level: INFO - - synapse.storage.SQL: - level: INFO - - ldap3: - level: INFO - - ldap_auth_provider: - level: INFO diff --git a/ansible/roles/synapse/files/basedir/config/log-worker-generic.yaml b/ansible/roles/synapse/files/basedir/config/log-worker-generic.yaml deleted file mode 100755 index 4437e9f..0000000 --- a/ansible/roles/synapse/files/basedir/config/log-worker-generic.yaml +++ /dev/null @@ -1,42 +0,0 @@ -version: 1 - -formatters: - fmt: - format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s- %(message)s' - -filters: - context: - (): synapse.logging.context.LoggingContextFilter - request: "" - -handlers: - console: - class: logging.StreamHandler - formatter: fmt - filters: [context] - file: - class: logging.handlers.TimedRotatingFileHandler - formatter: fmt - filename: /logs/worker-generic.log - when: midnight - backupCount: 3 - encoding: utf8 - -root: - level: INFO - handlers: - - console - - file - -loggers: - synapse: - level: INFO - - synapse.storage.SQL: - level: INFO - - ldap3: - level: INFO - - ldap_auth_provider: - level: INFO diff --git a/ansible/roles/synapse/files/basedir/config/log-worker-sync.yaml b/ansible/roles/synapse/files/basedir/config/log-worker-sync.yaml deleted file mode 100755 index 3ae9820..0000000 --- a/ansible/roles/synapse/files/basedir/config/log-worker-sync.yaml +++ /dev/null @@ -1,42 +0,0 @@ -version: 1 - -formatters: - fmt: - format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s- %(message)s' - -filters: - context: - (): synapse.logging.context.LoggingContextFilter - request: "" - -handlers: - console: - class: logging.StreamHandler - formatter: fmt - filters: [context] - file: - class: logging.handlers.TimedRotatingFileHandler - formatter: fmt - filename: /logs/worker-sync.log - when: midnight - backupCount: 3 - encoding: utf8 - -root: - level: INFO - handlers: - - console - - file - -loggers: - synapse: - level: INFO - - synapse.storage.SQL: - level: INFO - - ldap3: - level: INFO - - ldap_auth_provider: - level: INFO diff --git a/ansible/roles/synapse/tasks/main.yml b/ansible/roles/synapse/tasks/main.yml index 46ed388..1c55583 100644 --- a/ansible/roles/synapse/tasks/main.yml +++ b/ansible/roles/synapse/tasks/main.yml @@ -25,3 +25,18 @@ tags: - nginx - synapse + +- name: Create log configurations + ansible.builtin.template: + src: "nginx/synapse.conf" + dest: /home/{{ ansible_user }}/docker_compose/{{ matrix_service }}/config/log-{{ item }}.conf + owner: "{{ ansible_user }}" + mode: '0644' + tags: + - log + - synapse + loop: + - worker-generic + - worker-federation + - worker-sync + - homeserver diff --git a/ansible/roles/synapse/files/basedir/config/log.yaml b/ansible/roles/synapse/templates/synapse/log.yaml similarity index 93% rename from ansible/roles/synapse/files/basedir/config/log.yaml rename to ansible/roles/synapse/templates/synapse/log.yaml index b094b3d..f2aafb4 100755 --- a/ansible/roles/synapse/files/basedir/config/log.yaml +++ b/ansible/roles/synapse/templates/synapse/log.yaml @@ -17,7 +17,7 @@ handlers: file: class: logging.handlers.TimedRotatingFileHandler formatter: fmt - filename: /logs/homeserver.log + filename: /logs/worker-{{ item }}.log when: midnight backupCount: 3 encoding: utf8