LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Reply
 
Search this Thread
Old 06-04-2008, 01:46 PM   #1
akvino
Member
 
Registered: May 2007
Posts: 31

Rep: Reputation: 15
Changing logrotate on RHEL5


Hello all!

I have came across some conflicting instructions regarding on how to best change syslog.conf or logrotate.conf or logrotate.d/syslog file in order to make some modifications to /var/log/messages.

I want to save /var/log/messages for 90 days and to have them rotated daily, and compressed daily, or weekly. How do you and where do you make change to only affect /var/log/messages while everything else remains the same.

Thanks in advance.
 
Old 06-04-2008, 05:06 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,369
Blog Entries: 54

Rep: Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870
Just extract messages from /etc/logrotate.d/syslog to its own logrotate script and configure it according to your specs?
 
Old 06-04-2008, 07:30 PM   #3
akvino
Member
 
Registered: May 2007
Posts: 31

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
Just extract messages from /etc/logrotate.d/syslog to its own logrotate script and configure it according to your specs?
Can you give me some sort of example.
My biggest concern is stating entry into logrotate.conf and removing /var/log/messages from /etc/logrotate.d/syslog. Then if I do put entry in the logrotate.conf do I have to call /bin/kill -HUP syslogd line?
 
Old 06-05-2008, 05:47 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,369
Blog Entries: 54

Rep: Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870Reputation: 2870
You can keep all the info in /etc/logrotate.d/syslog but move messages to its own section above the rest:
Code:
/var/log/messages  {
    daily
    compress
    rotate 90
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
You don't have to signal Syslog manually after making the change. Logrotate only does that to make syslog process check its file descriptors for the new location of the logfile.
 
Old 06-05-2008, 02:51 PM   #5
akvino
Member
 
Registered: May 2007
Posts: 31

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
You can keep all the info in /etc/logrotate.d/syslog but move messages to its own section above the rest:
Code:
/var/log/messages  {
    daily
    compress
    rotate 90
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
You don't have to signal Syslog manually after making the change. Logrotate only does that to make syslog process check its file descriptors for the new location of the logfile.


That worked. I removed /var/log/messages from syslog and added new file called messages in the /etc/logrotate.d, with the similar syntax.

Thanks a bunch.
 
Old 06-10-2008, 02:00 PM   #6
akvino
Member
 
Registered: May 2007
Posts: 31

Original Poster
Rep: Reputation: 15
agh

Close but no cigar:

This is what I have now, how do I tell it to keep only gziped files.

-rw-r--r-- 1 root root 129783 Jun 10 13:56 messages
-rw-r--r-- 1 root root 24872 Jun 10 04:02 messages.1.gz
-rw------- 1 root root 1465313 Jun 5 08:46 messages.2
-rw-r--r-- 1 root root 24963 Jun 9 04:02 messages.2.gz
-rw------- 1 root root 2383515 Jun 1 04:02 messages.3
-rw-r--r-- 1 root root 21979 Jun 8 04:02 messages.3.gz
-rw------- 1 root root 2609877 May 25 04:02 messages.4


My setting in /etc/logrotate.d/messages

/var/log/messages {
daily
compress
rotate 90
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
 
Old 06-11-2008, 03:52 PM   #7
akvino
Member
 
Registered: May 2007
Posts: 31

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by akvino View Post
Close but no cigar:

This is what I have now, how do I tell it to keep only gziped files.

-rw-r--r-- 1 root root 129783 Jun 10 13:56 messages
-rw-r--r-- 1 root root 24872 Jun 10 04:02 messages.1.gz
-rw------- 1 root root 1465313 Jun 5 08:46 messages.2
-rw-r--r-- 1 root root 24963 Jun 9 04:02 messages.2.gz
-rw------- 1 root root 2383515 Jun 1 04:02 messages.3
-rw-r--r-- 1 root root 21979 Jun 8 04:02 messages.3.gz
-rw------- 1 root root 2609877 May 25 04:02 messages.4


My setting in /etc/logrotate.d/messages

/var/log/messages {
daily
compress
rotate 90
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}


My bad it works.
 
  


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
Why we use logrotate ? shipon_97 Linux - Newbie 4 01-09-2008 09:15 AM
About logrotate satimis *BSD 1 05-27-2007 01:08 PM
logrotate sidra Red Hat 10 08-01-2006 01:05 AM
Logrotate Help! MaverickApollo Linux - Software 3 02-19-2004 12:09 PM
logrotate dominant Linux - Newbie 1 02-13-2004 09:28 AM


All times are GMT -5. The time now is 05:34 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