Re: [squid-users] rotate logfiles with multiple instances of squid

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 24 Apr 2009 13:22:41 +1200

Ross Tsolakidis wrote:
> Hi all,
>
> I have a machine running multiple instances of squid, it's happily
> humming along.
> Debian package.
>
> One instance uses the standard startup script, with pretty much the
> default conf.
>
> The 2nd I start using
> squid -f /etc/squid/squid2.conf
>
> The squid2.conf file references different:
> http_port 3129 transparent
> cache_log /var/log/squid2/cache.log
> cache_store_log /var/log/squid2/store.log
> access_log /var/log/squid2/access.log squid
> pid_filename /var/run/squid2.pid
> cache_dir ufs /var/spool/squid2 20000 16 256
>
> I have also multiple logrotate files.
>
> 1st instance:
>
> cat /etc/logrotate.d/squid
> #
> # Logrotate fragment for squid.
> #
> /var/log/squid/*.log {
> daily
> compress
> delaycompress
> rotate 90
> missingok
> nocreate
> sharedscripts
> postrotate
> test ! -e /var/run/squid.pid || /usr/sbin/squid -k
> rotate
> endscript
> }
>
>
> 2nd instance:
>
> cat /etc/logrotate.d/squid2
> #
> # Logrotate fragment for squid2.
> #
> /var/log/squid2/*.log {
> daily
> compress
> delaycompress
> rotate 90
> missingok
> nocreate
> sharedscripts
> postrotate
> test ! -e /var/run/squid2.pid || /usr/sbin/squid -k
> rotate
> endscript
> }
>
> However, no go.
> The 1st instance is quite happy.
> The 2nd however has it's logfiles rotated, but squid does not write to
> them, so every morning I have to restart squid manually.
>
> Has anyone been able to get squid -k rotate working with multiple
> instances ?
> If so, how ?
> Or is there another way to do this ?

I think it's only a matter of passing the right config file on the
rotate call using the -f option so the temporary app can send the rotate
to the right PID.

I'd merge the two configs together too so they are handled the same way
no matter what.

/etc/logrotate.d/squid:

#
# Logrotate fragment for squid (both 1 and 2).
#
/var/log/squid/*.log /var/log/squid2/*.log {
         daily
         compress
         delaycompress
         rotate 90
         missingok
         nocreate
         sharedscripts
         postrotate

  test ! -e /var/run/squid1.pid || /usr/sbin/squid -f
/etc/squid/squid1.conf -k rotate

  test ! -e /var/run/squid2.pid || /usr/sbin/squid -f
/etc/squid/squid2.conf -k rotate

         endscript
}

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE6 or 3.0.STABLE14
   Current Beta Squid 3.1.0.7
Received on Fri Apr 24 2009 - 01:22:38 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 24 2009 - 12:00:03 MDT