evolinux-base: logs are rotated with dateext by default

This commit is contained in:
Jérémy Lecour 2021-09-30 12:07:02 +02:00 committed by Jérémy Lecour
parent 4a035d248d
commit 9b479f9c05
5 changed files with 32 additions and 5 deletions

View File

@ -59,6 +59,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
* evolinux-base: force Debian version to buster for Evolix repository (temporary)
* evolinux-base: split dpkg logrotate configuration
* evolinux-base: install freeipmi by default on dedicated hw
* evolinux-base: logs are rotated with dateext by default
* kibana: 7.x by default
* listupgrade: upstream release 21.06.3
* logstash: elastic_stack_version = 7.x

View File

@ -164,8 +164,10 @@ evolinux_logs_include: True
evolinux_logs_logrotate_confs: True
evolinux_logs_default_rotate: True
evolinux_logs_default_dateext : True
evolinux_logs_disable_logrotate_rsyslog: True
evolinux_logs_rsyslog_conf: True
evolinux_logrotate_dateformat: "-%Y%m%d%H"
# default www

View File

@ -1,11 +1,7 @@
/var/log/procmail.log {
daily
rotate 365
dateext
dateyesterday
dateformat .%Y%m%d
missingok
rotate 365
create 640 root adm
}

View File

@ -30,11 +30,34 @@
dest: /etc/logrotate.d/zsyslog
when: evolinux_logs_logrotate_confs | bool
- name: Configure logrotate.conf
- name: Configure logrotate.conf default rotate value
replace:
dest: /etc/logrotate.conf
regexp: "rotate [0-9]+"
replace: "rotate 12"
when: evolinux_logs_default_rotate | bool
- name: Enable logrotate.conf dateext option
lineinfile:
dest: /etc/logrotate.conf
line: "dateext"
regexp: "^#?\\s*dateext"
when: evolinux_logs_default_dateext | bool
- name: Enable logrotate.conf dateformat option
lineinfile:
dest: /etc/logrotate.conf
line: "dateformat {{ evolinux_logrotate_dateformat | mandatory }}"
regexp: "^#?\\s*dateformat.*"
insertafter: 'dateext'
when: evolinux_logs_default_dateext | bool
- name: Disable logrotate.conf dateyesterday option
lineinfile:
dest: /etc/logrotate.conf
line: "# dateyesterday"
regexp: "^\\s*dateyesterday"
insertafter: 'dateext'
when: evolinux_logs_default_dateext | bool
- meta: flush_handlers

View File

@ -1,8 +1,13 @@
# Custom EvoLinux
create 640 root adm
{% if not evolinux_logs_default_dateext %}
# BEGIN legacy setting
# … when global dateext and dateformat are not enabled
dateext
dateyesterday
dateformat .%Y%m%d
# END legacy setting
{% endif %}
missingok
notifempty
delaycompress