nox.im ยท All Snippets
We’re setting up OpenBSD’s log rotate utility newsyslog(8) to deal with our custom services, such as gmifs. Reasons for log rotation include retaining disk space and removing access information such as IP addresses to protect the privacy of users long term.
The file /etc/newsyslog.conf
specifies under which conditions what log files are to be rotated and
what actions shall be taken as well as retention.
# logfile_name owner:group mode count size when flags
/var/www/logs/gemini/access.log 644 4 * $W0 Z
/var/www/logs/gemini/debug.log 644 7 250 * Z
The access log file contains IP addresses, paths and status codes with timestamp, the debug log only contains information to improve the software, such as errors when handling requests or renewing certificates. The policy for each is therefore radically different.
A brief explanation of the used parameters:
$W0
above stands for weekly. If an asterisk is used, the time doesn’t matter, as it is the case with the debug logs above.Z
means the old log files are to be compressed with gzip(1).For more details see newsyslog(8) with man newsyslog
.