Rotating ezproxy.log on Linux

This article exists for historic reference.

LogFile directive

Please refer to the LogFile directive for the preferred way to implement EZproxy log file rotation.

Historic way to implement log rotation

The balance of this technote appears for historic reference.

Here is a sample shell script to rotate the ezproxy.log file with versions of EZproxy 2.2 and later running on Linux:

#!/bin/sh
# Sample log file rotation script
# Works with EZproxy 2.2 and later
# Change the directory below as relevant
cd /usr/local/ezproxy
NF=ezproxy.log.`date +%Y%m%d.%H%M%S`
# Rename current log file
mv ezproxy.log $NF
# Tell EZproxy to reopen a new ezproxy.log file
./ezproxy log
# Compress old log file
gzip $NF

If you save this script under a name such as /usr/local/ezproxy/rotate, then configure it to run using cron.