Logrotation issues between squid and lightsquid
-
at the end of this discussion
http://forum.pfsense.org/index.php/topic,20690.45.htmland issue was discovered between logrotations done in lightsquid vs. squid. The main issue has been resolved (see discussion) however there is still an issue with specifying the number of squid log files to keep when using light squid to do the rotation. Here is a summary.
Since squid -k rotate is being done by lightsquid and not squid this means there is no logfile_rotate entry in squid.conf specifying the number of logs to keep. The default is 10…. so squid.log will rotate through 0-9 with the oldest being removed. It probably is not a good idea (or maybe it is) to have lightsquid edit squid.conf although there are examples where it does.... For example, the lightsquid service modifies the log path (/var/squid/log) for squid... so maybe lightsquid should also modify the logile_rotate field squid.conf as well. If this is to be done then the webadmin page for lightsquid would have to be updated to get the number of logs to keep.
Here is the code in lightsquid_resync() updates the squid.conf file
// update squid conf
if (isset($config['installedpackages']['squid']['config'][0])) {
$config['installedpackages']['squid']['config'][0]['log_enabled'] = 'on';
$config['installedpackages']['squid']['config'][0]['log_dir'] = LS_SQUIDLOGPATH;
write_config();
squid_resync();
}Maybe this should include a
$config['installedpackages']['squid']['config'][0]['logile_rotate'] = X;
where X is the user specified number of copies of the log file to keep.
However, having said all that 10 if fine for me.
On the otherhand….
$config['installedpackages']['squid']['config'][0]['logile_rotate'] = X;
followed by a squid_sync(); might cause squid to add its on cron entry for log rotation… anyway.. you get the general idea. Some experimentation is required here to get this to work correctly.
And BTW... the language in the lightsquid admin which describes the logrotation probably should be cleaned up.. Here is how it currently reads.
Select squid log rotate period. System will execute task every XX time as from 00:00 hours.
This option will allow the updating of the faster
For example: if selected '2 day' - system wil start task every 2 day of month.
This option will allow the updating of the faster
Note: You must choose from that the rate of filling dialogue access.log squid;
The more customers, the more often it should be the job.You definitely don't want to "choose from that the rate of filling dialogue access.log squid;"... in the squid config page... By enabling log rotation and the number of log files in the squid admin page you endup turning on squid log rotation in squid resulting in 2 "squid -k rotate" entries in the cronfile!
Anyway... you might let the lightsquid maintainer know that it would be good to clean up the description to have explain how this all works.
Take care and thanks for your prompt response on this issue.
--luis
-
Probably best way to remove this option from LS.
Do not need duplicate functional. -
maybe… the log rotation in ls is much nicer than the one provided in squid. So... if this functionality were moved from ls to squid then I say yes... otherwise its fine the way it is... Currently the only restriction in having ls do the log rotation is that you are stuck with 10 copies of the log which is the squid default.
Take care.
--luis