mirror of
https://github.com/famedly/ansible-collection-matrix
synced 2024-09-20 14:01:54 +00:00
Merge pull request #2 from matrix-org/jcgruenhage/logrotate
rotate logs
This commit is contained in:
commit
7b62526650
7 changed files with 32 additions and 5 deletions
|
@ -18,3 +18,4 @@ matrix_synapse_registration_secret: "{{ matrix_registration_secret }}"
|
|||
matrix_synapse_macaroon_secret_key: "{{ matrix_macaroon_key }}"
|
||||
matrix_synapse_signing_key_path: "/opt/synapse/ssl/{{ matrix_synapse_domain }}.signing.key"
|
||||
matrix_synapse_version: "v0.28.1"
|
||||
matrix_synapse_log_days_keep: 30
|
||||
|
|
2
files/matrix_synapse.conf
Normal file
2
files/matrix_synapse.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
if $programname == 'matrix_synapse' then /var/log/matrix_synapse/matrix_synapse.log
|
||||
if $programname == 'matrix_synapse' then ~
|
|
@ -9,3 +9,8 @@
|
|||
state: restarted
|
||||
enabled: yes
|
||||
|
||||
- name: restart rsyslog
|
||||
become: yes
|
||||
service:
|
||||
name: rsyslog
|
||||
state: restarted
|
||||
|
|
|
@ -36,6 +36,18 @@
|
|||
owner: synapse
|
||||
group: synapse
|
||||
|
||||
- name: copy syslog config
|
||||
copy:
|
||||
src: matrix_synapse.conf
|
||||
dest: /etc/rsyslog.d/matrix_synapse.conf
|
||||
owner: root
|
||||
notify: restart rsyslog
|
||||
|
||||
- name: template logrotate config
|
||||
template:
|
||||
src: logrotate.j2
|
||||
dest: /etc/logrotate.d/matrix_synapse
|
||||
|
||||
- name: Deploy log config
|
||||
template:
|
||||
src: "log.config.j2"
|
||||
|
|
|
@ -2,7 +2,7 @@ version: 1
|
|||
|
||||
formatters:
|
||||
precise:
|
||||
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s- %(message)s'
|
||||
format: '%(name)s - %(lineno)d - %(levelname)s - %(request)s- %(message)s'
|
||||
|
||||
filters:
|
||||
context:
|
||||
|
|
9
templates/logrotate.j2
Normal file
9
templates/logrotate.j2
Normal file
|
@ -0,0 +1,9 @@
|
|||
/var/log/matrix_synapse/matrix_synapse.log {
|
||||
daily
|
||||
rotate {{ matrix_synapse_log_days_keep }}
|
||||
compress
|
||||
shred
|
||||
postrotate
|
||||
/usr/bin/pkill -HUP rsyslogd
|
||||
endscript
|
||||
}
|
|
@ -9,10 +9,8 @@ ExecStop=/opt/synapse/env/bin/synctl stop /opt/synapse/homeserver.yaml
|
|||
User=synapse
|
||||
Group=synapse
|
||||
Restart=always
|
||||
StandardOut=syslog
|
||||
SyslogIdentifier=matrix-synapse
|
||||
SyslogFacility=local3
|
||||
StandardOutput=syslog
|
||||
SyslogIdentifier=matrix_synapse
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
|
|
Loading…
Reference in a new issue