Commit e2b53e1f authored by Arnaud Fontaine's avatar Arnaud Fontaine

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 39ecca4c
...@@ -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 = 4aa5174de22135633f0fb4b41e29bbf9 md5sum = affe6f105c10edee16abf7a3e9340cd7
[template-balancer] [template-balancer]
filename = instance-balancer.cfg.in filename = instance-balancer.cfg.in
......
...@@ -402,7 +402,7 @@ config-maximum-delay = {{ slapparameter_dict["zope-longrequest-logger-maximum-de ...@@ -402,7 +402,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 = 8a774b677623c77c6ff0b88852fac643 md5sum = 36a1dcb098d0d643cdaf988a58751aa6
...@@ -53,12 +53,14 @@ rendered = ${logrotate-conf-parameter:logrotate-entries}/${:name} ...@@ -53,12 +53,14 @@ rendered = ${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