Commit 0409f691 authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Jérome Perrin

zope4: Handle log rotation following Zope documentation.

SIGUSR2 for reopening log files was handled by ZServer and waitress does not
handle signals at all, so we could handle this signal but Zope official
documentation recommends using logrotate `copytruncate`:
  https://zope.readthedocs.io/en/4.7/zopebook/MaintainingZope.html#log-rotation
  https://github.com/zopefoundation/Zope/issues/809
parent a2418691
...@@ -86,7 +86,7 @@ md5sum = 0ac4b74436f554cd677f19275d18d880 ...@@ -86,7 +86,7 @@ md5sum = 0ac4b74436f554cd677f19275d18d880
[template-zope] [template-zope]
filename = instance-zope.cfg.in filename = instance-zope.cfg.in
md5sum = 0451190711157fc204418662126d5cf8 md5sum = 5ff5314df6a865104a4fdf621d0e620f
[template-balancer] [template-balancer]
filename = instance-balancer.cfg.in filename = instance-balancer.cfg.in
......
...@@ -417,7 +417,7 @@ config-maximum-delay = {{ slapparameter_dict["zope-longrequest-logger-maximum-de ...@@ -417,7 +417,7 @@ config-maximum-delay = {{ slapparameter_dict["zope-longrequest-logger-maximum-de
< = logrotate-entry-base < = logrotate-entry-base
name = {{ name }} name = {{ name }}
log = {{ '${' ~ conf_parameter_name ~ ':event-log}' }} {{ '${' ~ conf_parameter_name ~ ':z2-log}' }} {{ '${' ~ conf_parameter_name ~ ':longrequest-logger-file}' }} {{ ' '.join(log_list) }} log = {{ '${' ~ conf_parameter_name ~ ':event-log}' }} {{ '${' ~ conf_parameter_name ~ ':z2-log}' }} {{ '${' ~ conf_parameter_name ~ ':longrequest-logger-file}' }} {{ ' '.join(log_list) }}
post = test ! -s {{ '${' ~ conf_parameter_name ~ ':pid-file}' }} || {{ bin_directory }}/slapos-kill --pidfile {{ '${' ~ conf_parameter_name ~ ':pid-file}' }} -s USR2 copytruncate = true
{% endmacro -%} {% endmacro -%}
{% for i in instance_index_list -%} {% for i in instance_index_list -%}
......
...@@ -18,8 +18,8 @@ md5sum = 7c41026716d856bba7c1252b72adbf77 ...@@ -18,8 +18,8 @@ md5sum = 7c41026716d856bba7c1252b72adbf77
[logrotate-entry-template] [logrotate-entry-template]
filename = logrotate_entry.in filename = logrotate_entry.in
md5sum = ce6ccdd52148770149e6e7525ab71e80 md5sum = 02c1009f8e0dc371cfc1290afef72ec7
[template-logrotate-base] [template-logrotate-base]
filename = instance-logrotate-base.cfg.in filename = instance-logrotate-base.cfg.in
md5sum = ed807da528595b7111c19e09056b01ce md5sum = 4e2baa1edd1d27831dda984769102a7c
...@@ -53,12 +53,14 @@ output = ${logrotate-conf-parameter:logrotate-entries}/${:name} ...@@ -53,12 +53,14 @@ output = ${logrotate-conf-parameter:logrotate-entries}/${:name}
context = context =
key backup :backup key backup :backup
key log :log key log :log
key copytruncate :copytruncate
key post :post key post :post
key pre :pre key pre :pre
key frequency :frequency key frequency :frequency
key rotate_num :rotate-num key rotate_num :rotate-num
key nocompress :nocompress key nocompress :nocompress
key delaycompress :delaycompress key delaycompress :delaycompress
copytruncate = false
post = post =
pre = pre =
frequency = daily frequency = daily
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
create create
olddir {{ backup }} olddir {{ backup }}
missingok missingok
{% if copytruncate %}copytruncate{% endif %}
{% if pre %}prerotate {% if pre %}prerotate
{{ pre }} {{ pre }}
endscript{% endif %} endscript{% endif %}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment