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 have the following logrotate configuration and its acting really strange. Logrotate does rotate the files but exits with an error every night and rsyslog continues to write to the old file for SOME of the logs. Its strange that maill log does get written to the new file but all the others don't. Unless I miss typed something this config should match exactly another rhel6 server I have. I can restart rsyslog manually though. With the exact same command and it works fine. I don't get it.
You can add criteria for file size and if you don't then it will choose a default that is probably stated in the manpage for logrotate. It will not always rotate a file if the file size doesn't match the criteria. However if you include force in the criteria, it will always rotate no matter the size of the file.
For size you would put in
Quote:
size 1M
or K depending on the maximum size log files you wish to allow.
The force option is when you invoke logrotate, not in the config by the way.
I'm not sure if it is cut/paste, or literal if there are no spaces to indent your postrotate options. I'm also not sure if that would be mandated. The examples in the man page indent the postrotate script lines 3 or 4 spaces. You may want to try that.
What error is it reporting? Or do you mean error is your interpretation when you're saying that it doesn't always rotate files?
A backup is created, but the original is left alone, and when you restart rsyslog it merely continues that last file? If that's correct, then in your postrotate steps, remove the log file for rsyslog.
Logrotate shouldn't do that. Perhaps this is rsyslog doing this. I'm betting it is. How about a prerotate script which stops rsyslog. Then start it in the postrotate. Although that seems too invasive, I'm worried about prerotate script actions always running, or if they'd only run if the rotate was going to occur. A different solution would be instead of a restart, in the postrotate, (1) stop rsyslog, (2) remove the log file, (3) start rsyslog.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.