Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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 am having a problem making my apache logs rotate at the specified time. I want them to rotate on the first of each month and to keep 6 months of logs. However, they seem to be rotating in a somewhat random fashion, for instance, July 19, June 14, May 26, April 7, March 15.
I have an 'httpd' entry in the /etc/logrotate.d directory. It looks like this:
Your problem description sounds like logrorate is rotating files at some default file size, regardless of your preference for monthly rotation.
Try decompressing a few of the files rotated at odd times. Are they all approximately the same size? If so, that is the default (I've not been able to find anything via google regarding such a default).
Then add a line to your logrotate config file: size=XXXk, or XXXm (where XXX is the file size to rotate). If the file rotates at mid month, double the value of the size= parameter which will hopefully rotate the file at month end. Of course, you must realize that the file will not necessarily always grow at the same rate, so there will be some variation on the rotation period.
An optional configuration would be to set the file size much larger than you expect it to be at month end, and use the -f option of logrotate to force log rotation at month end.
Thanks for your reply. The files are not being compressed. Here are file sizes of the log files. It doesn't appear to be rotating based on a specific size.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.