unbound: smarter logging

- stop using journald, write to /var/log/unbound/
- set up frequent log rotation for the huge log files
we are producing
This commit is contained in:
Yohaï-Eliel BERREBY 2020-05-02 16:49:33 +02:00
parent 1dca5d2259
commit c54e8f5d67
5 changed files with 39 additions and 2 deletions

View file

@ -2,3 +2,6 @@
systemd: systemd:
state: restarted state: restarted
name: unbound name: unbound
- name: read unbound apparmor config
command: apparmor_parser -r /etc/apparmor.d/usr.sbin.unbound

View file

@ -33,6 +33,27 @@
mode: 0644 mode: 0644
notify: restart unbound notify: restart unbound
- name: ensure unbound log directory exists
file:
path: /var/log/unbound
state: directory
mode: '0755'
owner: unbound
group: unbound
- name: ask apparmor to allow unbound to write to log file
template:
src: unbound-apparmor-config
dest: /etc/apparmor.d/local/usr.sbin.unbound
mode: '0644'
notify: read unbound apparmor config
- name: setup unbound log rotation
template:
src: unbound-logrotate.j2
dest: /etc/logrotate.d/unbound
mode: 0644
- name: setup recursive DNS server config - name: setup recursive DNS server config
template: template:
src: recursive.conf.j2 src: recursive.conf.j2

View file

@ -8,8 +8,7 @@ server:
verbosity: 3 verbosity: 3
# "" sends logs to stderr, journalctl will pick things up. # "" sends logs to stderr, journalctl will pick things up.
logfile: "" logfile: "/var/log/unbound/unbound.log"
do-ip4: yes do-ip4: yes
# FIXME: IPv6 deployment... someday... # FIXME: IPv6 deployment... someday...

View file

@ -0,0 +1 @@
/var/log/unbound/unbound.log rw,

View file

@ -0,0 +1,13 @@
/var/log/unbound/*.log {
daily
rotate 30
missingok
notifempty
compress
delaycompress
sharedscripts
create 644
postrotate
/usr/local/sbin/unbound-control log_reopen
endscript
}