dhcp: configure log rotation
This commit is contained in:
parent
7347829494
commit
6cce62850d
2 changed files with 24 additions and 3 deletions
|
@ -16,11 +16,21 @@
|
||||||
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:
|
||||||
|
|
11
roles/isc-dhcp-server/templates/logrotate.d/dhcp.j2
Normal file
11
roles/isc-dhcp-server/templates/logrotate.d/dhcp.j2
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/var/log/dhcp/dhcpd.log {
|
||||||
|
# common options
|
||||||
|
daily
|
||||||
|
rotate 365
|
||||||
|
missingok
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
notifempty
|
||||||
|
|
||||||
|
copytruncate
|
||||||
|
}
|
Loading…
Reference in a new issue