LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-19-2015, 08:07 PM   #1
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Rep: Reputation: 30
log rotate once the size is reached


I am working on to set up log rotate for messages files, once they reach 10M . The requirement is compress will work on reaching the size of 10MB , without reaching for the daily cron to happen?

If there any option available other than a crontab triggering of the /etc/cron.daily/logrotate.


Code:
/var/log/messages
{
 size 10M
 create 0600 root root
 compress
 rotate 5
}
 
Old 06-19-2015, 08:24 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
The only thing that comes to mind is a daemon process using inotify to monitor writes to the log file and trigger a logrotate when the size hits 10MB.
 
Old 06-22-2015, 06:32 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,877
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
You don't have to run logrotate daily a'la the system daemon, you can run logrotate anytime you want.

What you are asking is precisely something I do on an embedded system, my main process runs logrotate every 5 minutes. The rules are constructed to prevent logs from growing too large because the system storage is small and cannot afford to have the space be used up if one particular log streams tons of errors, and therefore the "size" term matters mostly in that architecture.
 
Old 06-24-2015, 06:01 PM   #4
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Original Poster
Rep: Reputation: 30
Code:
 	You don't have to run logrotate daily a'la the system daemon, you can run logrotate anytime you want. 
What you are asking is precisely something I do on an embedded system, my main process runs logrotate every 5 minutes

That is what I am looking for? The logrotate will be triggered to rotate the /var/log/messages , once it hits the size of 10M .As I do not have the facility to use cron , I am looking for other options .
 
Old 06-25-2015, 07:03 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,877
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by ZAMO View Post
Code:
     You don't have to run logrotate daily a'la the system daemon, you can run logrotate anytime you want. 
What you are asking is precisely something I do on an embedded system, my main process runs logrotate every 5 minutes
That is what I am looking for? The logrotate will be triggered to rotate the /var/log/messages , once it hits the size of 10M .As I do not have the facility to use cron , I am looking for other options .
It is one of many possible solutions. I will say that it would probably involve writing a script and establishing a service or daemon to manage it. If that doesn't fit with your parameters, then it does not.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Log rotate not rotate newFreeBSD Linux - Server 13 09-12-2013 08:59 PM
Log rotate natwar kumar Linux - Server 3 06-15-2012 11:16 PM
Trash has reached maximum size bucknap Linux - Newbie 2 03-08-2011 08:45 PM
log file size and rotate control lasantha Linux - Server 1 02-12-2009 03:12 AM
Log Rotate MaverickApollo Linux - Software 3 01-19-2004 12:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration