Re: [squid-users] SQUID Logrotate problem

From: Railic Njegos <railic.njegos_at_gmail.com>
Date: Tue, 2 Aug 2011 10:03:09 +0200

Hi Amos,
i was change logrotate script and on first server :

total 492444
-rw-r--r-- 1 squid squid 331395201 Aug 2 09:31 access.log
-rw-r--r-- 1 squid squid 18831645 Jul 4 23:13 access.log.1.gz
-rw-r--r-- 1 squid squid 15437442 Jun 7 21:03 access.log.2.gz
-rw-r--r-- 1 squid squid 7987085 May 16 14:37 access.log.3.gz
-rw-r--r-- 1 squid squid 4121806 May 1 04:02 access.log.4.gz
-rw-r--r-- 1 squid squid 3266210 Apr 24 04:02 access.log.5.gz
drwxr-xr-x 2 root root 4096 Jul 31 21:42 backup_logs
-rw-r--r-- 1 squid squid 26132668 Aug 2 08:47 cache.log
-rw-r--r-- 1 squid squid 2504821 Jul 4 23:13 cache.log.1.gz
-rw-r--r-- 1 squid squid 2681893 Jun 7 21:03 cache.log.2.gz
-rw-r--r-- 1 squid squid 2360296 May 16 14:37 cache.log.3.gz
-rw-r--r-- 1 squid squid 1389531 May 1 04:02 cache.log.4.gz
-rw-r--r-- 1 squid squid 934844 Apr 24 04:02 cache.log.5.gz
-rw-r--r-- 1 squid squid 1862553 Dec 9 2009 mail.txt
-rw-r--r-- 1 squid squid 7144 May 3 21:55 squid.out
-rw-r--r-- 1 squid squid 0 Apr 4 2009 store.log
-rw-r--r-- 1 squid squid 84702641 Sep 9 2009 trendmicro.log

On second server :

total 3760
-rw-r--r-- 1 squid squid 1260586 Aug 2 09:32 access.log
-rw-r--r-- 1 squid squid 444234 Aug 2 04:02 access.log.1.gz
-rw-r--r-- 1 squid squid 176058 Aug 1 04:02 access.log.2.gz
-rw-r--r-- 1 squid squid 257932 Jul 31 04:02 access.log.3.gz
-rw-r--r-- 1 squid squid 257325 Jul 30 04:02 access.log.4.gz
-rw-r--r-- 1 squid squid 290583 Jul 29 13:52 access.log.5.gz
-rw-r--r-- 1 squid squid 293009 Aug 2 09:27 cache.log
-rw-r--r-- 1 squid squid 64767 Aug 2 04:02 cache.log.1.gz
-rw-r--r-- 1 squid squid 1668 Aug 1 04:02 cache.log.2.gz
-rw-r--r-- 1 squid squid 30327 Jul 31 04:02 cache.log.3.gz
-rw-r--r-- 1 squid squid 91986 Jul 30 04:02 cache.log.4.gz
-rw-r--r-- 1 squid squid 13128 Jul 29 13:52 cache.log.5.gz
-rw-r--r-- 1 squid squid 534963 Dec 9 2009 mail.txt
-rw-r--r-- 1 squid squid 7068 Jul 4 23:22 squid.out
-rw-r--r-- 1 squid squid 0 Apr 4 2009 store.log
-rw-r--r-- 1 squid squid 0 Jul 23 2009 test.txt

Logrotate script is :
/var/log/squid/store.log /var/log/squid/cache.log /var/log/squid/access.log {

   weekly
   rotate 5
   copytruncate
   compress
   notifempty
   missingok
   sharedscripts

   postrotate
     /usr/sbin/squid -k rotate
   endscript
}

After rotatation on first server output is :

logrotate -f -v /etc/logrotate.d/squid
reading config file /etc/logrotate.d/squid
reading config info for /var/log/squid/store.log
/var/log/squid/cache.log /var/log/squid/access.log

Handling 1 logs

rotating pattern: /var/log/squid/store.log /var/log/squid/cache.log
/var/log/squid/access.log forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/squid/store.log
  log does not need rotating
considering log /var/log/squid/cache.log
  log needs rotating
considering log /var/log/squid/access.log
  log needs rotating
rotating log /var/log/squid/cache.log, log->rotateCount is 5
renaming /var/log/squid/cache.log.5.gz to
/var/log/squid/cache.log.6.gz (rotatecount 5, logstart 1, i 5),
renaming /var/log/squid/cache.log.4.gz to
/var/log/squid/cache.log.5.gz (rotatecount 5, logstart 1, i 4),
renaming /var/log/squid/cache.log.3.gz to
/var/log/squid/cache.log.4.gz (rotatecount 5, logstart 1, i 3),
renaming /var/log/squid/cache.log.2.gz to
/var/log/squid/cache.log.3.gz (rotatecount 5, logstart 1, i 2),
renaming /var/log/squid/cache.log.1.gz to
/var/log/squid/cache.log.2.gz (rotatecount 5, logstart 1, i 1),
renaming /var/log/squid/cache.log.0.gz to
/var/log/squid/cache.log.1.gz (rotatecount 5, logstart 1, i 0),
old log /var/log/squid/cache.log.0.gz does not exist
rotating log /var/log/squid/access.log, log->rotateCount is 5
renaming /var/log/squid/access.log.5.gz to
/var/log/squid/access.log.6.gz (rotatecount 5, logstart 1, i 5),
renaming /var/log/squid/access.log.4.gz to
/var/log/squid/access.log.5.gz (rotatecount 5, logstart 1, i 4),
renaming /var/log/squid/access.log.3.gz to
/var/log/squid/access.log.4.gz (rotatecount 5, logstart 1, i 3),
renaming /var/log/squid/access.log.2.gz to
/var/log/squid/access.log.3.gz (rotatecount 5, logstart 1, i 2),
renaming /var/log/squid/access.log.1.gz to
/var/log/squid/access.log.2.gz (rotatecount 5, logstart 1, i 1),
renaming /var/log/squid/access.log.0.gz to
/var/log/squid/access.log.1.gz (rotatecount 5, logstart 1, i 0),
old log /var/log/squid/access.log.0.gz does not exist
copying /var/log/squid/cache.log to /var/log/squid/cache.log.1
truncating /var/log/squid/cache.log
copying /var/log/squid/access.log to /var/log/squid/access.log.1
truncating /var/log/squid/access.log
running postrotate script
compressing log with: /bin/gzip
removing old log /var/log/squid/cache.log.6.gz
compressing log with: /bin/gzip
removing old log /var/log/squid/access.log.6.gz

On second server:

logrotate -f -v /etc/logrotate.d/squid
reading config file /etc/logrotate.d/squid
reading config info for /var/log/squid/store.log
/var/log/squid/cache.log /var/log/squid/access.log

Handling 1 logs

rotating pattern: /var/log/squid/store.log /var/log/squid/cache.log
/var/log/squid/access.log forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/squid/store.log
  log does not need rotating
considering log /var/log/squid/cache.log
  log needs rotating
considering log /var/log/squid/access.log
  log needs rotating
rotating log /var/log/squid/cache.log, log->rotateCount is 5
renaming /var/log/squid/cache.log.5.gz to
/var/log/squid/cache.log.6.gz (rotatecount 5, logstart 1, i 5),
renaming /var/log/squid/cache.log.4.gz to
/var/log/squid/cache.log.5.gz (rotatecount 5, logstart 1, i 4),
renaming /var/log/squid/cache.log.3.gz to
/var/log/squid/cache.log.4.gz (rotatecount 5, logstart 1, i 3),
renaming /var/log/squid/cache.log.2.gz to
/var/log/squid/cache.log.3.gz (rotatecount 5, logstart 1, i 2),
renaming /var/log/squid/cache.log.1.gz to
/var/log/squid/cache.log.2.gz (rotatecount 5, logstart 1, i 1),
renaming /var/log/squid/cache.log.0.gz to
/var/log/squid/cache.log.1.gz (rotatecount 5, logstart 1, i 0),
old log /var/log/squid/cache.log.0.gz does not exist
rotating log /var/log/squid/access.log, log->rotateCount is 5
renaming /var/log/squid/access.log.5.gz to
/var/log/squid/access.log.6.gz (rotatecount 5, logstart 1, i 5),
renaming /var/log/squid/access.log.4.gz to
/var/log/squid/access.log.5.gz (rotatecount 5, logstart 1, i 4),
renaming /var/log/squid/access.log.3.gz to
/var/log/squid/access.log.4.gz (rotatecount 5, logstart 1, i 3),
renaming /var/log/squid/access.log.2.gz to
/var/log/squid/access.log.3.gz (rotatecount 5, logstart 1, i 2),
renaming /var/log/squid/access.log.1.gz to
/var/log/squid/access.log.2.gz (rotatecount 5, logstart 1, i 1),
renaming /var/log/squid/access.log.0.gz to
/var/log/squid/access.log.1.gz (rotatecount 5, logstart 1, i 0),
old log /var/log/squid/access.log.0.gz does not exist
copying /var/log/squid/cache.log to /var/log/squid/cache.log.1
truncating /var/log/squid/cache.log
copying /var/log/squid/access.log to /var/log/squid/access.log.1
truncating /var/log/squid/access.log
running postrotate script
compressing log with: /bin/gzip
removing old log /var/log/squid/cache.log.6.gz
compressing log with: /bin/gzip
removing old log /var/log/squid/access.log.6.gz

I don't have idea why is this happening, and i think that the best
option in this
situation to create cronjob.

Njegos

On Fri, Jul 29, 2011 at 2:32 PM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> On 29/07/11 23:36, Railic Njegos wrote:
>>
>> Hi all,
>> definetly problem is with permission.
>>
>
> I see a different answer.
>
> Follow...
>
> <snip>
>>
>> [root_at_proxy01 ~]# logrotate -d -v -f /etc/logrotate.d/squid
>
> <snip>
>>
>> considering log /var/log/squid/access.log
>>   log needs rotating
>
> <snip>
>>
>> considering log /var/log/squid/cache.log
>>   log needs rotating
>
> <snip>
>>
>> rotating pattern: /var/log/squid/store.log  forced from command line
>> (5 rotations)
>> empty log files are not rotated, old logs are removed
>> considering log /var/log/squid/store.log
>>   log does not need rotating
>> not running postrotate script, since no logs were rotated
>
> BINGO!!!
>
> You have configured logrotated to only run squid -k rotate IF store.log had
> changes. It did not. Therefore no rotation.
>
> I think server1 is not caching => empty store.log => no rotate.
> I think server2 is caching => data in store.log => rotates.
>
> Use this logrotate.d config instead:
>
> /var/log/squid/store.log /var/log/squid/cache.log /var/log/squid/access.log
> {
>    weekly
>    rotate 5
>    copytruncate
>    compress
>    notifempty
>    missingok
>    sharedscripts
>    postrotate
>      /usr/sbin/squid -k rotate
>    endscript
> }
>
>
> Amos
> --
> Please be using
>  Current Stable Squid 2.7.STABLE9 or 3.1.14
>  Beta testers wanted for 3.2.0.10
>
Received on Tue Aug 02 2011 - 08:03:17 MDT

This archive was generated by hypermail 2.2.0 : Tue Aug 02 2011 - 12:00:03 MDT