SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
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 to Rotate one of my log file (test_cron.log) which is under /root/ on daily basis , so for that i have made one new file in under /etc/logrotate.d/soc_logs.
also added entry in crontab as : */1 * * * * /usr/sbin/logrotate /etc/logrotate.d/soc_logs
But it does not rotate daily.
and write code as follows.
Are you saying it doesn't check for rotation daily, or saying that you don't see the file rotated daily? The difference there is if you don't have the -f or --force option in your call to logrotate, then it won't force rotation and instead rely on the size qualifier of 20k. Have any of these files exceeded 20k prior to the daily call to logrotate and then not been rotated? Or have none of these files yet reached that size?
If you do invoke logrotate with the -f or --force option it will force rotation whether or not it feels rotation of a log file is required.
...additionally you can debug things and see for yourself running it as '/usr/sbin/logrotate -d /etc/logrotate.d/soc_logs;'. Do post the output if unsure.
*Ow, and there's no good reason to create and keep log files in the /root directory IMHO.
...additionally you can debug things and see for yourself running it as '/usr/sbin/logrotate -d /etc/logrotate.d/soc_logs;'. Do post the output if unsure.
*Ow, and there's no good reason to create and keep log files in the /root directory IMHO.
Excelling points. Right, not in /root. And you can manually run logrotate from the command line with the -d option as well as the -f option and see how it deals with your log file. That should assist you for when you're ready to let the cron job run it daily.
Generally, there is a file in /etc/cron.daily called logrotate that contains the "instructions" to run the program. You add your configuration file to the /etc/logrotate.d directory and you're done.
Double-check the permissions to the file you created, the permissions to the file you're attempting to run logrotate against, and verify that the size is large enough to trigger a rotate event.
If you wouldn't mind, please post some details of what you did to correct it. Others may come across your thread in the future and be interested in knowing what ended up correcting the problem so they can try it on their own system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.