Squid Log Retention Settings

It is possible to configure the number of days to retain traffic monitoring records in the UI / Squid / Logs / Settings as indicated on the following screenshot. By default logs are kept for 7 days. Depending on the amount of traffic your proxy processes it might be required to set it to lower value to conserve the hard disk space.

../../_images/log_days2.png

After clicking Save Changes button, Admin UI will generate the special file for logrotate daemon at /etc/logrotate.d/squid. Default file contents will look like the following.

#
#       Logrotate fragment for squid.
#
/var/log/squid/*.log {
        daily
        compress
        delaycompress
        rotate 7
        maxage 7
        missingok
        nocreate
        sharedscripts
        prerotate
                test ! -x /usr/sbin/sarg-reports || /usr/sbin/sarg-reports daily
        endscript
        postrotate
                test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate
        endscript
}

The rotate 7 parameter tells logrotate daemon to keep log files for 7 days. The maxage 7 parameter makes sure any rotated file is automatically deleted after 7 days.