Commit 34c110b5 authored by Alain Takoudjou's avatar Alain Takoudjou

stack logrotate: Add option to copytruncate log

copytruncate will truncate the original log file in place after creating a copy, instead of moving the old log file and optionally creating a new one.
parent e256ed97
...@@ -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 = 12a1822f83959677a3d344a5cc236e4a
[template-logrotate-base] [template-logrotate-base]
filename = instance-logrotate-base.cfg.in filename = instance-logrotate-base.cfg.in
md5sum = 8a774b677623c77c6ff0b88852fac643 md5sum = 37e20841ff7c377a0d638a2ffc74a6c9
...@@ -59,6 +59,7 @@ context = ...@@ -59,6 +59,7 @@ context =
key rotate_num :rotate-num key rotate_num :rotate-num
key nocompress :nocompress key nocompress :nocompress
key delaycompress :delaycompress key delaycompress :delaycompress
key truncate :truncate
post = post =
pre = pre =
frequency = daily frequency = daily
...@@ -66,6 +67,7 @@ rotate-num = 3650 ...@@ -66,6 +67,7 @@ rotate-num = 3650
backup = ${logrotate-directory:logrotate-backup} backup = ${logrotate-directory:logrotate-backup}
nocompress = nocompress =
delaycompress = true delaycompress = true
truncate =
[logrotate] [logrotate]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
create create
olddir {{ backup }} olddir {{ backup }}
missingok missingok
{% if truncate %}nocreate
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