Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've installed squid 2.7 stable9 in centos 5.4 x32 bit. I've installed and configured it successfully, its working fine. I want to clear few doubts, for that your kind help is needed.
Parallely, I've configured another server using binary rpms with same squid version (2.7 stable9).
I found that it creates a /etc/logrotate.d/squid for rotating log files (access.log, cache.log, store.log). Which is properly rotating log files using compress, dateext and size options (i manually added the size option).
But after compiling and installing from source code, its automatically not created. I want to rotate the log files in the same way as it is doing when i install using binary rpms.
Below logfile_rotate entry is present in my squid.conf file (in source code installation scenario) logfile_rotate 10
Below logfile_rotate entry is present in my squid.conf file which is commented (in binary rpm installation scenario) #logfile_rotate 10
I want to rotate the log files by size (as I've more than 200 users, these logfiles size increasing very fast, ie. approx 80 MB per hour), with compress and dateext option.
Is there any change need to be made in squid.conf or logrotate.conf or syslog.conf files ?
For your reply. I knew the options you suggested. I know that these lines should be put in the "squid" file resides in /etc/logrotate.d directory but my concern is something different.
1) While compiling squid through source code, this file is not creating automatically. Whether I need to create it manually and what ownership & permissions should be set on it ?
2) Is this is the only change i have to made or need to edit some more files (i.e. squid.conf, logrotate.conf, syslog.conf)?
3) whether i need to put any entry in cron for rotating squid logs automatically in hourly or daily intervals ?
4) If the log files size is average 80 MB approx in an hour, what should be the interval i should set to rotate it 10 MB per file ?
Eagarly waiting for you replies guys.
Thanks
Arunabh
Last edited by arunabh_biswas; 08-16-2010 at 12:20 AM.
For your reply. I knew the options you suggested. I know that these lines should be put in the "squid" file resides in /etc/logrotate.d directory but my concern is something different.
1) While compiling squid through source code, this file is not creating automatically. Whether I need to create it manually and what ownership & permissions should be set on it ?
Yes, working under Linux sometime you must create config file manually if it doesn't exist.
For ownership & permissions you can refer to package installed by binary file, on my system:
Code:
-rw-r--r-- 1 root root 543 Jan 21 2009 /etc/logrotate.d/squid
Quote:
Originally Posted by arunabh_biswas
2) Is this is the only change i have to made or need to edit some more files (i.e. squid.conf, logrotate.conf, syslog.conf)?
You can change more options in squid.conf if you want. Notice that logrotate.conf is global config file and /etc/logrotate.d including config files which for individual service (it will overwrite global options)
Quote:
Originally Posted by arunabh_biswas
3) whether i need to put any entry in cron for rotating squid logs automatically in hourly or daily intervals ?
If you install from binary file you will see logrotate file in /etc/cron.daily (default). Otherwise you can manually create it or put it in /etc/cron.hourly (depend on you) with something like this:
Code:
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
Quote:
Originally Posted by arunabh_biswas
4) If the log files size is average 80 MB approx in an hour, what should be the interval i should set to rotate it 10 MB per file ?
No need to care for interval if you rotate based on logs file size. (I haven't tested )
Supplement: I have re-read the manpage:
Quote:
minsize size
Log files are rotated when they grow bigger then size bytes, but not before the additionally speci-fied time interval (daily, weekly, monthly, or yearly). The related size option is similar except that it is mutually exclusive with the time interval options, and it causes log files to be rotated without regard for the last rotation time. When minsize is used, both the size and timestamp of a log file are considered.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.