LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 01-07-2011, 03:57 AM   #1
kamalkgarg
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Rep: Reputation: Disabled
RHEL5 syslog facility Local6 Logrotate configuration Issue


Hi,

I am using syslog Facility6 for the logs generated by an application. I have appended the following line in the /etc/syslog.conf

local6.* /var/log/app.log

And my application logs are successfully getting created in /var/log/app.log. So no issues with syslog.

Here is what I further need to do:

I need to rotate these logs (/var/log/app.log) daily or whenever the size of the file exceeds 1MB. Also I would like to keep 60 log files.

I am not sure about configuring the logrotation based on the above criterion for syslog local6.* logs in RHEL5.

Thanks in advance !

Kamal
 
Old 01-07-2011, 05:04 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Reading 'man logrotate' and checking out the examples in /etc/logrotate.d/ should get you there. The facility does not matter and make sure you restart (kill -HUP) syslogd. If unsure create the logrotate script for app and fill it with what you require and post it.

Last edited by unSpawn; 01-07-2011 at 05:06 AM.
 
Old 01-07-2011, 05:12 AM   #3
kamalkgarg
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
ok.. so I can also create a logrotate configuration file for /var/log/app.log in /etc/logrotate.d

Thanks for your reply !

Regards,
Kamal
 
Old 01-07-2011, 05:30 AM   #4
kamalkgarg
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
I created the a file /etc/logrotate.d/app with the following contents

/var/log/app.log {
daily
rotate 60
size 1M
postrotate
/usr/bin/killall -HUP syslogd
endscript
}

I think this will do the job?

Regards,
Kamal

Last edited by kamalkgarg; 01-07-2011 at 06:02 AM. Reason: Typo
 
Old 01-07-2011, 06:06 AM   #5
kamalkgarg
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Executed logrotate -f /etc/logrotate.conf command and logs are getting rotated every time I execute this command.

But /var/log/app.log is not getting rotated when it's size exceeds 1M even though i have mentioned the same in /etc/logrotate.d/app.

Is there any further configuration required to be done for log file to rotate immediately when the size exceeds 1M?

Thanks,
Kamal
 
Old 01-07-2011, 06:18 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by kamalkgarg View Post
/var/log/app.log is not getting rotated when it's size exceeds 1M even though i have mentioned the same in /etc/logrotate.d/app.
Remove the "daily" directive, prohibiting the log file from getting rotated every day. Then test by letting the log file exceed 1M and run 'logrotate -d /etc/logrotate.d/app'. Confirm the output alerts you the log now needs to be rotated.
 
Old 01-07-2011, 06:43 AM   #7
kamalkgarg
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Removing the daily directive from /etc/logrotoate.d/app didn't help.

However I added the following command in crontab to trigger logrotate every minute

* * * * * /usr/sbin/logrotate /etc/logrotate.conf

After this update, /var/log/app.log are getting rotated on size exceeding 1M.

But I don't know how is this going to affect other stuff.

Any idea?
 
Old 01-07-2011, 07:22 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by kamalkgarg View Post
Removing the daily directive from /etc/logrotoate.d/app didn't help.
As a technical person (or so I would hope) you should realize "didn't help" and "doesn't work" are about the least interesting things to reply especially since I showed you how to debug logrotate. if that isn't a hint I'm ready to repeat that but with caps lock on.


Quote:
Originally Posted by kamalkgarg View Post
But I don't know how is this going to affect other stuff.
Logrotate can easily run at an interval shorter than once a day but FCOL! If you don't know how running logrotate every minute will affect "other stuff" then why the ${PURPORTEDLY_EXCEEDINGLY_WARM_LOCATION} do you do stuff like that in the first place?
 
Old 01-10-2011, 04:08 AM   #9
kamalkgarg
LQ Newbie
 
Registered: Jan 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
thanks !
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can we config to display facility/priority column in syslog output (RHELAS 4) LiXin Linux - Server 5 04-30-2008 11:09 AM
pure-ftpd syslog facility devacom Linux - Software 0 01-05-2005 07:11 AM
Syslog logger facility problem tuxster SUSE / openSUSE 0 01-02-2005 04:17 PM
Syslog logger facility problem tuxster Linux - General 0 12-25-2004 12:29 PM
syslog facility gunter *BSD 3 08-21-2004 04:22 PM

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

All times are GMT -5. The time now is 01:32 AM.

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