LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-2006, 10:36 PM   #1
Swakoo
Member
 
Registered: Apr 2005
Distribution: Red Hat / Fedora / CentOS
Posts: 508

Rep: Reputation: 30
Logrotate - did I get it right?


My logrotate for maillog is as such

Quote:
/usr/local/psa/var/log/maillog.processed {
daily
missingok
rotate 7
size 50M
compress
nocreate
}
My intention is to have the log rotate and have an archive of 7days at anyone time. Also, each log file should be no more than 50MB before compress, so if in one day the log hits 100MB, I should have 2 logs per day and by the end of 7 days, I should have 14logs.

Is my above logrotate settings correctly set to achieve what I need? because currently my latest log file is 37MB and it didn't get compress, and the last log entry was 4am before it started on a new log...

Questions:

1) my log was not compress after it started a new log. Is it because it didn't reach 50MB?

2) I understand the service/log restarts at 4am each day (hence the new log). Is it possible to control when this restart happens?

3) Will the above settings be able to achieve my intended objectives? 7 days log, each file no > 50MB, can have multiple logfiles each day (<50MB)

Many thanks!
 
Old 06-20-2006, 06:14 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,718
Blog Entries: 54

Rep: Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967Reputation: 2967
1) my log was not compress after it started a new log. Is it because it didn't reach 50MB?
About compression: logrotate usually is set up as a cronjob, so if there's any errors they should be in root's email. About size: AFAIK you should read "rotate this log daily OR now if size matches threshold", which comes in handy when you run it several times a day. Note that if size isn't triggered and the run is set to daily it may produce less than fourteen logs. BTW, you don't need to run all of logrotate: you can force a specific job to run (say in a separate cronjob) with "logrotate /etc/logrotate.d/nameofjob".


2) I understand the service/log restarts at 4am each day (hence the new log). Is it possible to control when this restart happens?
Restarts related to logrotate runs are usually placed in "postrotate" statements. Check your logrotate.conf, /etc/logrotate.d/ files or other cronjobs.


3) Will the above settings be able to achieve my intended objectives? 7 days log, each file no > 50MB, can have multiple logfiles each day (<50MB) / so if in one day the log hits 100MB, I should have 2 logs per day and by the end of 7 days, I should have 14logs.
No, it don't work that way. You specified seven logs to be archived. If you for instance run logrotate twice a day and want fourteen logs, you'll have to specifiy "rotate 14".
 
  


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
webalizer and logrotate PowerMatt Linux - Software 8 10-14-2004 01:31 AM
Logrotate Help! MaverickApollo Linux - Software 3 02-19-2004 01:09 PM
logrotate dominant Linux - Newbie 1 02-13-2004 10:28 AM
logrotate Rig24 Linux - Newbie 2 07-11-2003 06:08 AM
logrotate MrJoshua Linux - General 2 09-25-2002 10:55 AM


All times are GMT -5. The time now is 03:50 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration