[squid-users] logrotate with SMP problem !!!

From: Dr.x <ahmed.zaeem_at_netstream.ps>
Date: Sun, 17 Nov 2013 07:09:26 -0800 (PST)

hi all ,
ive configured squid to be logrotated from script in /etc/logrotate.d/squid
but ,
logrotating is not working fine !

logrotate is rotating the logs ,
but ..................................

it keeping files with numbered names !!!

as an expamle :
ls -l /var/log/squid
i have
root_at_squid ~]# ls -l /var/log/squid/
total 534836
-rw-r----- 1 squid squid 55496603 Nov 15 13:06 access.log
-rw-r----- 1 squid squid 57658795 Nov 15 13:06 access.log.0
-rw-r----- 1 squid squid 0 Nov 15 03:24 access.log.1
-rw-r----- 1 squid squid 127757003 Nov 15 13:06 access.log.2
-rw-r----- 1 squid squid 0 Nov 15 03:24 access.log.3
-rw-r----- 1 squid adm 0 Nov 15 03:24 access.log.4
-rw-r----- 1 squid squid 306240056 Nov 15 03:24 access.log.5
-rw-r----- 1 squid squid 0 Nov 14 03:46 access.log.6
-rw-r----- 1 squid squid 0 Nov 14 03:46 access.log.7
-rw-r----- 1 squid adm 0 Nov 14 03:46 access.log.8
-rw-r----- 1 squid squid 227762 Nov 15 13:02 cache.log
-rw-r----- 1 squid squid 248204 Nov 15 13:05 cache.log.1
-rw-r----- 1 squid squid 280 Nov 15 03:24 cache.log.2
-rw-r----- 1 squid adm 0 Nov 15 03:24 cache.log.3
-rw-r----- 1 squid squid 333 Nov 14 03:46 cache.log.5
-rw-r----- 1 squid squid 280 Nov 14 03:46 cache.log.6

as we see , i have access.log.1 ,access.log.2 ,access.log.3
...............................access.log.6

i dont want the numbered values here ,
i want logroate to delete these values and just keep on the original files
as :
access.log & cache.log
and not any other files !!!!
...........................
i will post my current logrotate config and want to tell me wt do i need to
modify with them
========================================================================
[root_at_squid ~]# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}

# system-specific logs may be also be configured here.
====================================================================================
[root_at_squid ~]# cat /etc/logrotate.d/squid
/var/log/squid/*.log {
daily
rotate 0
missingok
create 640 squid adm
sharedscripts
postrotate
test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate

endscript
}
[root_at_squid ~]#
=============================================================
if i remove them manually and apply force option ,
[root_at_squid logrotate.d]# rm -rf /var/log/squid/access.log.*
[root_at_squid logrotate.d]# rm -rf /var/log/squid/cache.log.*
[root_at_squid logrotate.d]# ls -l /var/log/squid/
total 7544
-rw-r----- 1 squid squid 7701518 Nov 17 10:04 access.log
-rw-r----- 1 squid squid 12439 Nov 17 09:56 cache.log
[root_at_squid logrotate.d]#
[root_at_squid logrotate.d]#
[root_at_squid logrotate.d]# du sh /var/log/squid/
du: cannot access `sh': No such file or directory
7568 /var/log/squid/
[root_at_squid logrotate.d]# du -sh /var/log/squid/
7.4M /var/log/squid/
[root_at_squid logrotate.d]# logrotate -f -v /etc/logrotate.d/squid
reading config file /etc/logrotate.d/squid
reading config info for /var/log/squid/*.log

Handling 1 logs

rotating pattern: /var/log/squid/*.log forced from command line (no old
logs will be kept)
empty log files are rotated, old logs are removed
considering log /var/log/squid/access.log
  log needs rotating
considering log /var/log/squid/cache.log
  log needs rotating
rotating log /var/log/squid/access.log, log->rotateCount is 0
dateext suffix '-20131117'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/squid/access.log.1 to /var/log/squid/access.log.2
(rotatecount 1, logstart 1, i 1),
old log /var/log/squid/access.log.1 does not exist
renaming /var/log/squid/access.log.0 to /var/log/squid/access.log.1
(rotatecount 1, logstart 1, i 0),
old log /var/log/squid/access.log.0 does not exist
log /var/log/squid/access.log.2 doesn't exist -- won't try to dispose of it
rotating log /var/log/squid/cache.log, log->rotateCount is 0
dateext suffix '-20131117'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /var/log/squid/cache.log.1 to /var/log/squid/cache.log.2
(rotatecount 1, logstart 1, i 1),
old log /var/log/squid/cache.log.1 does not exist
renaming /var/log/squid/cache.log.0 to /var/log/squid/cache.log.1
(rotatecount 1, logstart 1, i 0),
old log /var/log/squid/cache.log.0 does not exist
log /var/log/squid/cache.log.2 doesn't exist -- won't try to dispose of it
renaming /var/log/squid/access.log to /var/log/squid/access.log.1
disposeName will be /var/log/squid/access.log.1
creating new /var/log/squid/access.log mode = 0640 uid = 500 gid = 4
renaming /var/log/squid/cache.log to /var/log/squid/cache.log.1
disposeName will be /var/log/squid/cache.log.1
creating new /var/log/squid/cache.log mode = 0640 uid = 500 gid = 4
running postrotate script
removing old log /var/log/squid/access.log.1
error: error opening /var/log/squid/access.log.1: No such file or directory
[root_at_squid logrotate.d]# ls -l /var/log/squid/
total 7680
-rw-r----- 1 squid squid 8439 Nov 17 10:05 access.log
-rw-r----- 1 squid squid 13443 Nov 17 10:05 access.log.0
-rw-r----- 1 squid squid 0 Nov 17 10:04 access.log.2
-rw-r----- 1 squid squid 0 Nov 17 10:04 access.log.3
-rw-r----- 1 squid adm 0 Nov 17 10:04 access.log.4
-rw-r----- 1 squid squid 7805576 Nov 17 10:04 access.log.6
-rw-r----- 1 squid squid 1665 Nov 17 10:04 cache.log
-rw-r----- 1 squid squid 280 Nov 17 10:04 cache.log.3
-rw-r----- 1 squid squid 14342 Nov 17 10:04 cache.log.5
[root_at_squid logrotate.d]#
====================
!!!!!
why files still there ????

*not sure if this has a relation when we work with smp with squid !!*

regards

-----
Dr.x

--
View this message in context: http://squid-web-proxy-cache.1019090.n4.nabble.com/logrotate-with-SMP-problem-tp4663333.html
Sent from the Squid - Users mailing list archive at Nabble.com.
Received on Sun Nov 17 2013 - 15:10:21 MST

This archive was generated by hypermail 2.2.0 : Sun Nov 17 2013 - 12:00:04 MST