1

I'm configuring relayd to log to its own log, and I'm not clear on whether I should run "pkill...".

I can see the following in the default newsyslog.conf:

# logfile_name owner:group mode count size when flags /var/log/maillog 640 7 * 24 Z /var/log/pflog 600 3 250 * ZB "pkill -HUP -u root -U root -t - -x pflogd" /var/www/logs/access.log 644 4 * $W0 Z "pkill -USR1 -u root -U root -x httpd" /var/www/logs/error.log 644 7 250 * Z "pkill -USR1 -u root -U root -x httpd" 

I included the maillog line to show that there is no "pkill..." flags command for a log that is for a single daemon, which at least seems similar to my log configuration for relayd.

1 Answer 1

1

When you rotate the log you are in fact creating a new file, which will be on a different inode. Since httpd keeps its log file open while it's running, the file descriptor to which it writes the log messages will now point to a non-existing file. This is why you need to send it the SIGUSR1 signal, which will make it reopen the log file (i.e. drop the stale file descriptor and open the new file). As per httpd's man page.

httpd rereads its configuration file when it receives SIGHUP and reopens log files when it receives SIGUSR1.

(Note that this is not an universal rule, SIGUSR1 will trigger different things for different software.)

I am not entirely sure of this, but the fact that there is no need to signal smtpd that the log has been rotated strongly suggests that it keeps opening and closing the log file, which might be inexpensive on a mail server, but probably isn't on a busy HTTP server.

There is no indication of the need to signal relayd before rotating the log on its man page, but (and this is merely a hunch) I'd expect it to behave like httpd. My instances of relayd use syslog, so I can't replicate your use case, but you can use something like fstat | grep "relayd" to check whether it keeps the log file open or not.

You'll get a more definitive answer asking on the [email protected] mailing list, or by looking at the code.

1
  • I ended up just experimenting, and although I can't explain why, the behavior is that relayd does not require a reload, as it happily pukes its handshake errors into the new file. Commented Feb 8, 2022 at 12:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.