0

all good? I'm trying to make my squid proxy server like one we have but, of all the problems I had, this one is that is making me a little sad.

I have a squid proxy 5.7 on a debian 12, when the log tries to rotate it gives the following message: 2023/07/28 00:00:01 kid1| log rotation failed: (2) No such file or directory 2023/07/28 00:00:01 kid1| renaming file /var/log/squid/cache.log to /var/log/squid/cache.log.0failed: (2) No such file or directory

On /var/log/squid, there's files access.log and others from 2 to 4 and cache.log has 2 to 5, it's not creating access.log1 and cache.log.1.

I tried to create manually the files cache.log.1 and access.log.1, when it log rotates, these files "vanishes" and will not create new ones.

I tried to use copytruncate with no avail.

here's the logrotate config for squid

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

When I run logrorate manually this is what shows:

rotating pattern: /var/log/squid/*.log  forced from command line (2 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/squid/access.log
  Now: 2023-07-28 08:47
  Last rotated at 2023-07-28 08:40
  log needs rotating
considering log /var/log/squid/cache.log
  Now: 2023-07-28 08:47
  Last rotated at 2023-07-28 08:40
  log needs rotating
rotating log /var/log/squid/access.log, log->rotateCount is 2
dateext suffix '-20230728'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/squid/access.log.1 does not exist
renaming /var/log/squid/access.log.2.gz to /var/log/squid/access.log.3.gz (rotatecount 2, logstart 1, i 2), 
old log /var/log/squid/access.log.2.gz does not exist
renaming /var/log/squid/access.log.1.gz to /var/log/squid/access.log.2.gz (rotatecount 2, logstart 1, i 1), 
old log /var/log/squid/access.log.1.gz does not exist
log /var/log/squid/access.log.3.gz doesn't exist -- won't try to dispose of it
rotating log /var/log/squid/cache.log, log->rotateCount is 2
dateext suffix '-20230728'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
previous log /var/log/squid/cache.log.1 does not exist
renaming /var/log/squid/cache.log.2.gz to /var/log/squid/cache.log.3.gz (rotatecount 2, logstart 1, i 2), 
old log /var/log/squid/cache.log.2.gz does not exist
renaming /var/log/squid/cache.log.1.gz to /var/log/squid/cache.log.2.gz (rotatecount 2, logstart 1, i 1), 
old log /var/log/squid/cache.log.1.gz does not exist
log /var/log/squid/cache.log.3.gz doesn't exist -- won't try to dispose of it
renaming /var/log/squid/access.log to /var/log/squid/access.log.1
renaming /var/log/squid/cache.log to /var/log/squid/cache.log.1
running postrotate script

Here's the /var/log/squid

-rw-r----- 1 proxy proxy   27027 jul 28 09:09 access.log
-rw-r----- 1 proxy proxy       0 jul 28 09:00 access.log.0
-rw-r----- 1 proxy proxy  173964 jul 28 09:00 access.log.2
-rw-r----- 1 proxy proxy    1494 jul 28 08:47 access.log.3
-rw-r----- 1 proxy proxy  112645 jul 28 08:39 access.log.4
-rw-r----- 1 proxy proxy 1039403 jul 28 00:00 access.log.5
drwxr-xr-x 6 proxy proxy    4096 jul  6 17:16 cache
-rw-r----- 1 proxy proxy     510 jul 28 09:00 cache.log
-rw-r----- 1 proxy proxy      77 jul 28 09:00 cache.log.0
-rw-r----- 1 proxy proxy    3076 jul 28 09:00 cache.log.2
-rw-r----- 1 proxy proxy     796 jul 28 08:47 cache.log.3
-rw-r----- 1 proxy proxy   41787 jul 28 08:40 cache.log.4
-rw-r----- 1 proxy proxy   53664 jul 28 00:00 cache.log.5

Thanks for your attention and guidance.

Renobr
  • 3
  • 2
  • After I removed the # in copytruncate line, it'll create backup files but not the access.log.1,2,3 and so on. Can't understand whats happening. – Renobr Jul 31 '23 at 11:32

0 Answers0