LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Squid Access Logs date wise (https://www.linuxquestions.org/questions/linux-software-2/squid-access-logs-date-wise-589232/)

the_gripmaster 10-03-2007 06:30 PM

Squid Access Logs date wise
 
I am using Squid 2.6 on RHEL 5. I want a separate access log everyday to be created automatically instead of one big access.log file in /var/log/squid

Is there a way to do this editing the /etc/squid/squid.conf file?

Thanks in advance.

gilead 10-03-2007 09:38 PM

You can use logrotate to do this (are you using it for other log files)? You can create an entry for squid in /etc/logrotate.d/squid and add the following content. This example rotates weekly for 5 weeks. The postrotate entry of /usr/local/squid/sbin/squid -k rotate causes squid to close and re-open its logs so no silliness happens with open file handles For this to happen, your squid.conf file needs to have logfile_rotate set to 0:
Code:

/var/log/squid/access.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
}
/var/log/squid/cache.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
}

/var/log/squid/store.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
# This script asks squid to rotate its logs on its own.
# Restarting squid is a long process and it is not worth
# doing it just to rotate logs
    postrotate
      /usr/local/squid/sbin/squid -k rotate
    endscript
}



All times are GMT -5. The time now is 11:58 PM.