LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 07-31-2006, 05:13 PM   #1
sidra
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora Core 3, Red Hat 9, CentOS 4.2, Mandriva, Ret Hat Enterprise Linux 4.0
Posts: 116

Rep: Reputation: 15
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!
 
Old 07-31-2006, 05:20 PM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

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

Last edited by billymayday; 07-31-2006 at 05:25 PM.
 
Old 07-31-2006, 05:27 PM   #3
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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?
 
Old 07-31-2006, 06:57 PM   #4
sidra
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora Core 3, Red Hat 9, CentOS 4.2, Mandriva, Ret Hat Enterprise Linux 4.0
Posts: 116

Original Poster
Rep: Reputation: 15
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?
 
Old 07-31-2006, 06:58 PM   #5
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Which app?
 
Old 07-31-2006, 07:00 PM   #6
sidra
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora Core 3, Red Hat 9, CentOS 4.2, Mandriva, Ret Hat Enterprise Linux 4.0
Posts: 116

Original Poster
Rep: Reputation: 15
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...
 
Old 07-31-2006, 07:24 PM   #7
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
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
 
Old 07-31-2006, 07:38 PM   #8
sidra
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora Core 3, Red Hat 9, CentOS 4.2, Mandriva, Ret Hat Enterprise Linux 4.0
Posts: 116

Original Poster
Rep: Reputation: 15
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!
 
Old 07-31-2006, 07:48 PM   #9
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Do you mean run it like a daemon? I think logrotate will simply exit once it's run, so it won't stay alive.
 
Old 08-01-2006, 12:58 AM   #10
sidra
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora Core 3, Red Hat 9, CentOS 4.2, Mandriva, Ret Hat Enterprise Linux 4.0
Posts: 116

Original Poster
Rep: Reputation: 15
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 &

???
 
Old 08-01-2006, 01:05 AM   #11
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logrotate - did I get it right? Swakoo Linux - General 1 06-20-2006 05:14 AM
Logrotate Help! MaverickApollo Linux - Software 3 02-19-2004 12:09 PM
logrotate dominant Linux - Newbie 1 02-13-2004 09:28 AM
logrotate Rig24 Linux - Newbie 2 07-11-2003 05:08 AM
logrotate MrJoshua Linux - General 2 09-25-2002 09:55 AM


All times are GMT -5. The time now is 04:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration