Friday, May 29, 2026

Re: i2pd log rotation in OpenBSD.

AW Green wrote: > Hi, David. > > Sorry for responding offlist (I'm not a subscriber), but fwiw you don't > need to shutdown the i2pd daemon for log rotation.  This is done instead > by sending the HUP signal to the i2pd process: > https://github.com/PurpleI2P/i2pd/issues/389 > > Conveniently, newsyslog(8) can send this signal for you when you provide > a pid_file argument in /etc/newsyslog.conf.  For example, here is the > line I use in my install: > .. > /var/log/i2pd/i2pd.log  _i2pd:_i2pd     644  6     *    $D13    Z /var/ > lib/i2pd/i2pd.pid > .. > > Sending HUP to i2pd will also reload the tunnel config and change any > transient keys, so scheduled key rotation can be a useful side-effect of > this pid_file approach. > https://docs.i2pd.website/en/latest/user-guide/run/ > > Thank you for your work updating and improving this port! > > Arthur Hi Arthur, Thank you for the detailed note, and for pointing this out. You are right: using HUP through newsyslog(8)'s pid_file field is a better approach than suggesting a graceful restart or shutdown for log rotation. I had missed that i2pd handles log reopening this way, and the additional tunnel config reload / transient key rotation side effect is useful too. The corrected README section would look like this: ``` Logging ======= By default, the OpenBSD port of ${PKGSTEM} sends its log messages to syslogd(8), which writes them to the /var/log/daemon file. The default log level of ${PKGSTEM} ("warn") can be very verbose. You may want to reduce this log verbosity by changing the "loglevel" parameter in /etc/i2pd/i2pd.conf. If you want log messages to be written to another file, e.g. /var/log/i2pd/i2pd.log, you can change the "log" and "logfile" parameters in /etc/i2pd/i2pd.conf. To have this log file rotated automatically, add an entry to /etc/newsyslog.conf using the i2pd pid file so newsyslog(8) can send SIGHUP to the daemon after rotation. For example: /var/log/i2pd/i2pd.log _i2pd:_i2pd 644 6 * $D13 Z /var/i2pd/i2pd.pid Sending SIGHUP is enough for log rotation, and also makes i2pd reload its tunnel configuration and rotate transient keys. ``` Thanks again for the correction and for testing this in your install. Best regards, David.

No comments:

Post a Comment