LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   logrotate (https://www.linuxquestions.org/questions/red-hat-31/logrotate-469500/)

sidra 07-31-2006 05:13 PM

logrotate
 
Hi,

I want to monitor the size of a log file, it should not exceed 35M. I understand that cron runs logrotate once during the course of a day. So that's not feasible because the size could go beyond the limit. Even if i have cron.hourly run logrotate, there could be an interval within which the size could go beyond the limit. I don't want that.

To strictly adhere to the limit does logroate have to keep on running in the background once the system comes up? If so, which file or script will i have to add or modify to bring it up and keep it running as a daemon as soon as the system comes up. Is this a good way of doing it or is there another way.

I also considered using MONIT to monitor this...but not sure if that's a better idea. If it is please let me know how and why.

Thank you in advance!

billymayday 07-31-2006 05:20 PM

Which log are you trying to limit? Some applications have the ability to limit logs in their config.

billymayday 07-31-2006 05:27 PM

This is from the logrotate man page

Quote:

Normally, logrotate is run as a daily cron job. It will not modify a
log multiple times in one day unless the criterium for that log is
based on the log’s size and logrotate is being run multiple times each
day, or unless the -f or -force option is used.
Are you sure the size option doesn't work for you?

sidra 07-31-2006 06:57 PM

I did read the man page including this. I'm working on the design for the project right now. I will be using the size option with

size=35M

But i'm not sure if that's going to make a difference if logrotate is run only once a day by cron. What if the file requires rotation later on that day.

Any thoughts?

billymayday 07-31-2006 06:58 PM

Which app?

sidra 07-31-2006 07:00 PM

I'm just working on logging for a project i'm working on. Via ACE Logging i'm going to be directing log messages from my applications to syslog-ng. syslog-ng will write to a file xyz. The size of xyz should not exceed 35M. That is what i'm trying to accomplish and ensure...

billymayday 07-31-2006 07:24 PM

Short of setting up a separate config file for the logs you want to monitor and running logrotate more often with that config (ie run with this config every 30 mins or so, but leave the standard logrotate running daily) nothoing neat comes to mind I'm afraid.

Not the most elegant solution

sidra 07-31-2006 07:38 PM

So then the best would probably be to keep it running in the background...none are efficient but this will give a 100% assurity that the size will not exceed. Which script will i have to modify? inittab or write another one?

Thanks!

billymayday 07-31-2006 07:48 PM

Do you mean run it like a daemon? I think logrotate will simply exit once it's run, so it won't stay alive.

sidra 08-01-2006 12:58 AM

Yea i meant run it like a daemon and having it running all the time! Are you saying this is not possible????

Can't you do:

logrotate &

???

billymayday 08-01-2006 01:05 AM

I'm not saying it isn't possible, I just don't know how to do it if you can


All times are GMT -5. The time now is 03:34 AM.