Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop 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.
As one can see these has been a lot more than a week since the last rotate. Can anyone see why logrotate doesn't rotate the logs?
And what's the best way to debug these kind of problems?
I can't find the docs I had on why this was happening to me as well, but I ended up using Apache's log rotation commands instead of logrotate for my web logs. I have the following in httpd.conf on one of my boxes:
I can't find the docs I had on why this was happening to me as well, but I ended up using Apache's log rotation commands instead of logrotate for my web logs. I have the following in httpd.conf on one of my boxes:
I didn't know Apache came with it's own logrotate implementation. Nice feature. It's bugging me, though, that linux logrotate doesn't work, so if anyone knows what may be causing this I'd greatly appreciate a hint.
Anyways, I found Apache's logrotate script under /usr/sbin/rotatelogs, and this is the information I got from the script:
Code:
[root@server ~]# /usr/sbin/rotatelogs -h
Usage: /usr/sbin/rotatelogs [-l] <logfile> <rotation time in seconds> [offset minutes from UTC] or <rotation size in megabytes>
Add this:
TransferLog "|/usr/sbin/rotatelogs /some/where 86400"
or
TransferLog "|/usr/sbin/rotatelogs /some/where 5M"
to httpd.conf. The generated name will be /some/where.nnnn where nnnn is the
system time at which the log nominally starts (N.B. if using a rotation time,
the time will always be a multiple of the rotation time, so you can synchronize
cron scripts with it). At the end of each rotation time or when the file size
is reached a new log is started.
I doesn't seem like there is any kind of file size compression going on. Is the only solution writing a cron job myself to handle this?
This is quite embarrasing, but I suspect that the reason why the above code didn't work was because of the comment (i.e. "# Keep logs for 3 years"). I found this in the man page:
Code:
Note that comments may appear anywhere in the config file as long as the first non-whitespace character on the line is a #.
I have to wait a while to verifiy that I got logrotate working, but it seems very promising.
This is quite embarrasing, but I suspect that the reason why the above code didn't work was because of the comment (i.e. "# Keep logs for 3 years"). I found this in the man page:
Code:
Note that comments may appear anywhere in the config file as long as the first non-whitespace character on the line is a #.
I have to wait a while to verifiy that I got logrotate working, but it seems very promising.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.