3

How do I get the access.log, cache.log, and, store.log files stored for a longer duration of time on a server, say, for about fifteen days; currently there is a server which stores the files typically for about a day plus one, that is a set of files created today are compressed by the end of today and kept till tomorrow while a new set of files are created automatically tomorrow after which the compressed set of files are deleted.

1

You're after either access_log rotate=15 <log location> or logfile_rotate 15 (in /etc/squid/squid.conf).

  • access_log will override the default rotation for the access log only, but it is not available in squid 2. By adding rotate=15 you specify the number of files:

    access_log rotate=15 <log location>
    
  • logfile_rotate works for all logs. This is a plain numeric option:

    log_rotate 15
    

I linked to the most recent documentation, but you may be (and probably are) running an older version of squid. Squid documentation is great, just follow the links to the correct version from the main documentation page.

Extra note

The rotation is not specified in any time period (days, weeks, months or anything like that). Instead, rotation is performed every time squid -k rotate is called. If your logs are being rotated you certainly have a cron job or systemd timer running squid -k rotate.

  • +1 for mentioning squid -k rotate – Rui F Ribeiro Oct 7 '16 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.