LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 12-13-2006, 11:32 AM   #1
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Rep: Reputation: 15
how logroate work?


hi,
I add following code to my redhat server's /etc/logroate.conf file:

# see "man logrotate" for details
# rotate log files weekly
#weekly

# keep 4 weeks worth of backlogs
#rotate 4

# create new (empty) log files after rotating old ones
#create

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}

# system-specific logs may be also be configured here.

compress

/home/cc/logs/logs/oi {
rotate 1

daily

olddir /var/oi


}

what I want to do is move the logs in /home/cc/logs/logs/oi tt /var/oi and zipped veryday and keep them for a week, so that will get more space for my home directory.
but it don't work, i checked my /var/oi ,it's empty, even I force to excute it by:
#/usr/sbin/logroate -f /etc/logroate.conf
still same.
can anyone tell me why?
thanks!
jimy
 
Old 12-13-2006, 12:36 PM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Remove the code you added below system-specific section and take a look in files at /etc/logrotate.d/ and use one of them as template for your needs.
Just create a new file under /etc/logrotate.d/ and go on.
 
Old 12-13-2006, 01:48 PM   #3
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Original Poster
Rep: Reputation: 15
greate. it works! thanks a lot!
 
Old 12-14-2006, 08:58 AM   #4
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Original Poster
Rep: Reputation: 15
two more question, do I need to setup anything more for automatic excute the config file I created at /etc/logrotate ? this is what I write in it:

/home/cc/logs/oi/*.xml {
copytruncate
daily
rotate 7
compress
missingok
}

the *xml is the log file in oi directory looks like:log20061213171209Lbuild.358.xml

and the other question is when I use the command #logrotate -f /etc/logroate.d/oi to run it, I get a lot of log20061213171209Lbuild.358.xml kind files they are all empty, is any way to clean them? or not generate them?

thank!
 
Old 12-14-2006, 07:36 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
logrotate doesn't create logfiles from scratch, it simply copies them and deletes any older than (in your case) 7 iterations ago.
Incidentally, if you've got compress set (as you seem to) then the file you are looking at is not one of the ones that have been rotated. They should end in '.gz' .
If the file is empty, look at the creating program.
 
Old 12-15-2006, 09:06 AM   #6
jimmyjiang
Member
 
Registered: Jun 2006
Posts: 132

Original Poster
Rep: Reputation: 15
but, I put "daily " on there, it should execute everyday, but it's not. what's wrong?
 
  


Reply



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
Logroate is not compressing apache logs Suinatsa Linux - Software 0 07-07-2006 06:16 AM
NFS doesn't work work well with mounted NTFS volumes? StevenO Linux - Networking 6 02-13-2006 10:54 AM
I configured logroate.d -> squid but didn't roate according to my config. Niceman2005 Linux - Networking 4 02-06-2005 08:49 PM
got ALSA to work in root, need help getting it to work in my user profile ic3 Slackware 2 11-28-2003 10:32 PM
FALCONS EYE (nethack) FAILS ON STARTUP, use to work, wont work even after reinstall roorings Linux - Software 0 10-08-2003 10:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 07:10 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
Open Source Consulting | Domain Registration