dhcp: configure log rotation

This commit is contained in:
Yohaï-Eliel BERREBY 2020-04-06 17:58:02 +02:00
parent 7347829494
commit 6cce62850d
2 changed files with 24 additions and 3 deletions

View file

@ -16,12 +16,22 @@
mode: u=rwx,g=rx,a=rx mode: u=rwx,g=rx,a=rx
state: directory state: directory
- name: Ensute rsyslog knows where to send dhcp logs - name: Ensure rsyslog knows where to send dhcp logs
lineinfile: lineinfile:
path: /etc/rsyslog.conf path: /etc/rsyslog.conf
regexp: '^local7[.][*]'
line: "local7.* /var/log/dhcp/dhcpd.log" line: "local7.* /var/log/dhcp/dhcpd.log"
- name: Configure dhcp log rotation
template:
src: logrotate.d/dhcp.j2
dest: /etc/logrotate.d/dhcp
mode: 0644
- name: restart rsyslog
systemd:
name: rsyslog
state: restarted
- name: Configure /etc/default/isc-dhcp-server - name: Configure /etc/default/isc-dhcp-server
template: template:
src: default/isc-dhcp-server.j2 src: default/isc-dhcp-server.j2

View file

@ -0,0 +1,11 @@
/var/log/dhcp/dhcpd.log {
# common options
daily
rotate 365
missingok
compress
delaycompress
notifempty
copytruncate
}