LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-30-2009, 10:46 AM   #1
shaife720
LQ Newbie
 
Registered: Jul 2009
Posts: 9

Rep: Reputation: 0
logrotate for messages file


Hi
I need to modify my /etc/logrotate.d/syslog file so after evry rotation it will create the new messages file with 604 permissions rw-----r
The problem I have is that I don't know were to put the right line in the file and what is the right syntax to do it only for the messages file ,
see the content of syslog :
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

you can see that this file works not only on the messages file but also on others.

Thanks
Shai

Last edited by shaife720; 07-30-2009 at 10:47 AM.
 
Old 07-30-2009, 11:19 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 553Reputation: 553Reputation: 553Reputation: 553Reputation: 553Reputation: 553
Why not take /var/log/messages out of that function, and give it its own function, where you can put your create option?

Like so:

Code:
/var/log/messages {
create 0604 root root
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
PS - see `man logrotate` for further details and other options.

Sasha

Last edited by GrapefruiTgirl; 07-30-2009 at 11:23 AM. Reason: Welcome to LQ, by the way :)
 
Old 08-10-2009, 05:50 AM   #3
shaife720
LQ Newbie
 
Registered: Jul 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Thank You sahsa
 
  


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
logrotate creates /var/log/messages with the wrong selinux context on RHEL5 smoyse Red Hat 3 03-30-2009 08:20 PM
Logrotate/ bash script not rotating file noir911 Linux - Server 2 01-15-2009 03:56 PM
Redirecting the kernel messages to file other than /var/log/messages jyotika_b83 Linux - General 3 04-28-2005 06:39 PM
syslog and firestarter - log messages to another file than messages mule Linux - Newbie 0 08-07-2003 03:35 AM
Error in Logrotate.status file tomdlam Linux - General 0 10-17-2002 08:38 PM

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

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