Cron syslog issue

Discussion in 'Desktop Operation' started by manjunath.nm89, Sep 29, 2011.

  1. manjunath.nm89

    manjunath.nm89 New Member

    I have written a custom cron. This cron executes a rake task every 5 minutes. I also log the trace of this execution in a file locally on my server. The whole process seems to execute seamlessly every 5 minutes, but then it seems to log it in /var/log/syslog. I investigated on the syslog and found that system's critical errors, and other cron issues are logged in syslog. Has anybody faced this kind of an issue ?
     
  2. Mark_NL

    Mark_NL Member

    Everything is logged in syslog

    it's defined in the config file /etc/rsyslog.conf
    Code:
    *.*;auth,authpriv.none		-/var/log/syslog
    If you want cron log to go somewhere else, uncomment the line
    Code:
    #cron.*				/var/log/cron.log
    and all cronlog entries will go there (they will also still go to syslog though.
     
  3. manjunath.nm89

    manjunath.nm89 New Member

    Syslog.conf

    But in my etc/syslog.conf, Everything is referenced as /mnt/log/syslog and not /var/log/syslog .

    Is this the same for you also.. I Have logged in as root.
     
  4. Mark_NL

    Mark_NL Member

    Ah well, that depends on what the admin of the server set-up.

    default it's /var/log/* .. but maybe if you run in a openvz container, vps, or smth .. those folders could be different (weird, but ok) ..

    If all your log files are in /mnt/log/*

    then set a line: cron.* -/mnt/log/cron.log

    in your rsyslog.conf and restart rsyslogd
     
  5. manjunath.nm89

    manjunath.nm89 New Member

    syslog issue

    Thanks for the quick reply..

    But, I have these logs stored both in

    /var/log/syslog and /mnt/log/syslog

    is this possible. My configuration seems to store only in /mnt/log/syslog
     
  6. Mark_NL

    Mark_NL Member

    it might help if you post the content of rsyslog.conf :)
     
  7. manjunath.nm89

    manjunath.nm89 New Member

    /etc/rsyslog.conf


    Code:
    #################
    #### MODULES ####
    #################
    
    $ModLoad imuxsock # provides support for local system logging
    $ModLoad imklog   # provides kernel logging support (previously done by rklogd)
    #$ModLoad immark  # provides --MARK-- message capability
    
    $KLogPath /proc/kmsg
    
    # provides UDP syslog reception
    #$ModLoad imudp
    #$UDPServerRun 514
    
    # provides TCP syslog reception
    #$ModLoad imtcp
    #$InputTCPServerRun 514
    
    
    ###########################
    #### GLOBAL DIRECTIVES ####
    ###########################
    
    #
    # Use traditional timestamp format.
    # To enable high precision timestamps, comment out the following line.
    #
    $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
    
    # Filter duplicated messages
    $RepeatedMsgReduction on
    
    #
    # Set the default permissions for all log files.
    #
    $FileOwner syslog
    $FileGroup adm
    $FileCreateMode 0640
    
    $DirCreateMode 0755
    $Umask 0022
    $PrivDropToUser syslog
    $PrivDropToGroup syslog
    
    #
    # Include all config files in /etc/rsyslog.d/
    #
    $IncludeConfig /etc/rsyslog.d/*.conf
    

    /etc/rsyslog.d/50-default.conf


    Code:
    auth,authpriv.*                 /mnt/log/auth.log
    *.*;auth,authpriv.none          -/mnt/log/syslog
    #cron.*                         /mnt/log/cron.log
    daemon.*                        -/mnt/log/daemon.log
    kern.*                          -/mnt/log/kern.log
    lpr.*                           -/mnt/log/lpr.log
    mail.*                          -/mnt/log/mail.log
    user.*                          -/mnt/log/user.log
    
    #
    # Logging for the mail system.  Split it up so that
    # it is easy to write scripts to parse these files.
    #
    mail.info                       -/mnt/log/mail.info
    mail.warn                       -/mnt/log/mail.warn
    mail.err                        /mnt/log/mail.err
    
    # Logging for INN news system
    #
    news.crit                       /mnt/log/news/news.crit
    news.err                        /mnt/log/news/news.err
    news.notice                     -/mnt/log/news/news.notice
    
    #
    # Some `catch-all' logfiles.
    #
    *.=debug;\
            auth,authpriv.none;\
            news.none;mail.none     -/mnt/log/debug
    *.=info;*.=notice;*.=warn;\
            auth,authpriv.none;\
            cron,daemon.none;\
            mail,news.none          -/mnt/log/messages
    
     
  8. Mark_NL

    Mark_NL Member

    Code:
    sed -i 's/#cron\./cron\./' /etc/rsyslog.conf
    /etc/init.d/rsyslog restart
    all cron related stuff will go into /mnt/log/cron.log now
     
  9. Mark_NL

    Mark_NL Member

    I guess that /mnt/log and/or /var/log is a symlink to one another

    show me:
    Code:
    ls -al /var
    ls -al /mnt
     

Share This Page