LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-08-2008, 10:54 AM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 484

Rep: Reputation: 30
Why we use logrotate ?


Dear friends ,

I cannot understand how to use logrotate feature in Linux to read the 'man' file . Plz give me a sample example about it and tell me why it is necessary to use it ?
 
Old 01-08-2008, 10:59 AM   #2
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Question

Quote:
Originally Posted by shipon_97 View Post
Why we use logrotate ?

I cannot understand how to use logrotate feature in Linux to read the 'man' file .
Do we?
 
Old 01-08-2008, 11:05 AM   #3
author_unknown
Member
 
Registered: Aug 2007
Location: Buffalo, NY
Distribution: Fedora 7, RHEL5, CentOS 5 and Backtrack 2.0
Posts: 73

Rep: Reputation: 15
logrotate performs log rotation and Logrotation is important because the log files that represent the action of 'syslog rules' can grow to a large size very quickly. Logrotate is often installed by default on your linux system, which rotates the logs based on certain criteria. The criteria can be based on size or frequency. Frequency, in turn, can be tied to daily,weekly and so on. Logrotation is performed automatically by the system.

If u want to see how logrotate actually works, then take a gud look at /etc/logrotate.conf file......

Actually depending on the frequency(daily, weekly, hourly or so), the log files keep on rotating. for example if logrotation is set to be done weekly then after 1 week, the picture would be.........

boot.log -> boot.log.1 -> boot.log.2 -> boot.log.3 -> boot.log.4 -> wiped from the disk

where boot.log is a log file.
 
Old 01-08-2008, 11:27 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
man logrotate
 
Old 01-09-2008, 10:15 AM   #5
odcheck
Member
 
Registered: Aug 2006
Distribution: Fedora, CentOS, RHEL, Debian
Posts: 978

Rep: Reputation: 30
Can anybody give me a hint on how to setup a logrotate for fetchmail?

Code:
/var/log/fetchmail {     In my case this would be /var/log/fetchmaillog
    weekly
    rotate 5
    compress
    missingok
    notifempty
    create 640 fetchmail root    Again in my case this would be create 600 fetchmaillog root
    sharedscripts
    postrotate
        if [ -f /var/run/fetchmail/fetchmail.pid ]; then \  again in my case ist would be /var/run/fetchmail.pid
            if [ -x /usr/sbin/invoke-rc.d ]; then \
                invoke-rc.d fetchmail restart > /dev/null; \
            else \
                /etc/init.d/fetchmail restart > /dev/null; \
            fi; \
        fi;
    endscript
}
So this
Code:
invoke-rc.d
is from a debian system. But I am running CentOS 5.1 x86 i386.
I guess that after this
Code:
if
the script performs a restart of fetchmail so.
Can I just apply this to me needs like if.... instead of /usr/sbin/invoke-rc.d to write /usr/bin fetchmail and so on ...
Another thing is that my mails get catched by a cron job like this
Code:
/usr/bin/fetchmail -v -k -L /var/log/fetchmaillog -f '/root/.fetchmailrc' >/dev/null 2>&1
the
Code:
>/dev/null...
is only cause I don't want to have always a mail sent to root afterwards.
So if I would rewrite the script above and then if a pid exists etc.. and I start /usr/bin/fetchmail I guess I will have to attach all those -v -k -L as well ?
 
  


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
About logrotate satimis *BSD 1 05-27-2007 02:08 PM
logrotate sidra Red Hat 10 08-01-2006 02:05 AM
Logrotate - did I get it right? Swakoo Linux - General 1 06-20-2006 06:14 AM
Logrotate Help! MaverickApollo Linux - Software 3 02-19-2004 01:09 PM
logrotate Rig24 Linux - Newbie 2 07-11-2003 06:08 AM


All times are GMT -5. The time now is 08:58 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration