Logging, Syslog and Log Anaylsys Forums
September 08, 2010, 08:35:54 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
   Home   WIKI BLOG Help Search Recent Topics GoogleTagged Login Register  
Pages: [1]
  Print  
Author Topic: Syslog And Logrotate  (Read 4060 times)
garige
Newbie
*
Offline Offline

Posts: 1


View Profile
« on: January 09, 2005, 10:26:55 pm »

Hi all,

I am using syslog to store call detail records into a file and rotate that file using logrotate. I specifed logrotate as a cron job.

Syslog.conf entry

local2. info (facility.level) /var/log/cdrlog (destination file)

when i logrotated cdrlog file 2 times it did generated cdrlog and cdrlog1.
With a new call after logrotation CDRs are getting entered into cdrlog1 insted of cdrlog.
Why is this happening? Am i doing anything wrong?

thanks in advance..

Regards,
Siddhardha Garige
Logged
mutex
Administrator
Newbie
*****
Offline Offline

Posts: 901


View Profile
« Reply #1 on: January 09, 2005, 11:25:38 pm »

Logrotate basically renames the files.  What is happening is that logrotate is changing the name of the file, but the actual file indentifier, the inode, is staying the same.  Syslog has opened the file based on the inode (that's all abstracted by the operating system) and after logrotate runs, it still has the file formerly know as cdrlog, now cdrlog1 open for writing.  
In a nutshell, logrorate isn't stopping and restarting syslogd.  You need to send the HUP signal to syslogd when logrotate runs.  You need to make sure that you have a postrorate declaration like this:
Code:

    postrotate
        /usr/bin/killall -HUP httpd
    endscript


Hope that helps!  Let us know if that works or if you need additional help.
Logged
Pages: [1]
  Print  

 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!