Hello community,
I have a problem with newsyslog(8) and the R flag, specified in newsyslog.conf(5) entry. The man page states:
I have recently installed and configured Unbound recursive, validating resolver and have set up, in /etc/newsyslog.conf, a logging policy to keep the logs for the past 366 days (one year).
/etc/newsyslog.conf entry follows:
/usr/local/etc/unbound/unbound-reopen-log-file contents:
Unbound has a control interface that allows you to set/unset parameters and a bunch of other things like dumping the cache, loading the cache from a file, etc. One command allows the operator to close and reopen the log file.
The reasoning behind using
I have copied the Unbound /etc/newsyslog.conf entry into a new file so I can debug it and run
The logs don't get compressed and the /usr/local/etc/unbound/run file doesn't get created. The outcome is that Unbound doesn't log anymore until restart or
I have even traced the above newsyslog(8) command using ktrace(1) and searched the ktrace.out file for /usr/local/sbin/unbound-control log_reopen occurrences. There is just one occurrence, when the file is loaded in memory. Below is the section of ktrace.out pointing that out:
Do you have any idea how can I fix this besides sending the HUP signal to Unbound which results in invalidating the cache.
Thank you, Cheers and Goodwill.
I have a problem with newsyslog(8) and the R flag, specified in newsyslog.conf(5) entry. The man page states:
Code:
R if this flag is set the newsyslog(8) will run shell com-
mand defined in path_to_pid_cmd_file after rotation
instead of trying to send signal to a process id stored
in the file.
I have recently installed and configured Unbound recursive, validating resolver and have set up, in /etc/newsyslog.conf, a logging policy to keep the logs for the past 366 days (one year).
/etc/newsyslog.conf entry follows:
Code:
/var/log/unbound/unbound.log unbound:wheel 640 366 * @T00 XCR /usr/local/etc/unbound/unbound-reopen-log-file
/usr/local/etc/unbound/unbound-reopen-log-file contents:
Code:
#!/bin/sh
#
# This small script reopens the log file after log rotation
# by newsyslog(8).
# Reopen the log
/usr/local/sbin/unbound-control log_reopen
# Show me that you've been executed successfully
/usr/bin/touch /usr/local/etc/unbound/run
exit 0
Unbound has a control interface that allows you to set/unset parameters and a bunch of other things like dumping the cache, loading the cache from a file, etc. One command allows the operator to close and reopen the log file.
The reasoning behind using
# unbound-control log_reopen
instead of sending the HUP signal is that Unbound keeps the cache in memory and at HUP signal the cache is lost. I don't want to invalidate the cache each evening. My network is rather small but I will be using Unbound in rather large networks in the future where the cache really matters.I have copied the Unbound /etc/newsyslog.conf entry into a new file so I can debug it and run
# newsyslog -vF -f newsyslog.debug
. The output follows:
Code:
Processing newsyslog.debug
/var/log/unbound/unbound.log <366X>: --> trimming log....
Signal all daemon process(es)...
Pause 10 seconds to allow daemon(s) to close log file(s)
Compress all rotated log file(s)...
newsyslog: log /var/log/unbound/unbound.log.0 not compressed because daemon(s) not notified
The logs don't get compressed and the /usr/local/etc/unbound/run file doesn't get created. The outcome is that Unbound doesn't log anymore until restart or
# unbound-control log_reopen
command run.I have even traced the above newsyslog(8) command using ktrace(1) and searched the ktrace.out file for /usr/local/sbin/unbound-control log_reopen occurrences. There is just one occurrence, when the file is loaded in memory. Below is the section of ktrace.out pointing that out:
Code:
46524 newsyslog RET fstat 0
46524 newsyslog CALL read(0x3,0x800c0d000,0x1000)
46524 newsyslog GIO fd 3 read 155 bytes
"### ---Unbound logs
/var/log/unbound/unbound.log unbound:wheel 640 366 * @T00 XCR /u\
sr/local/etc/unbound/unbound-reopen-log-file
"
Do you have any idea how can I fix this besides sending the HUP signal to Unbound which results in invalidating the cache.
Thank you, Cheers and Goodwill.