rsyslog as service in Redhat

Everything related with getting rsyslog up and running (but not beyond that point ;))

Moderator: rgerhards

rsyslog as service in Redhat

Postby clustermaster on Wed Mar 19, 2008 5:14 pm

Can anybody please copy my the rsyslog servcie file you are using in Redhat?
I currently start the service manually and when ever logrotate runs, the service fails - as in, the service still shows as running, but no messages are being accepted from remote devices.
So I want to restart with Cron 5 min after the daily logrotate.
Many thanks in advance!
Marc
clustermaster
New
 
Posts: 3
Joined: Thu Mar 13, 2008 4:23 pm

Professional Services Information

  • Custom written rsyslog.conf?
  • Maintenance Contract?
  • Installation support?

Postby sandiso on Wed May 07, 2008 9:13 am

I use this in RHEL5 for rsyslogd 3.* witch is without klogd.

Code: Select all
#!/bin/bash
# chkconfig: 2345 12 88
# Source function library.
. /etc/init.d/functions

RETVAL=0

start() {
        [ -x /usr/local/sbin/rsyslogd ] || exit 5

        # Source config
        if [ -f /etc/sysconfig/rsyslog ] ; then
                . /etc/sysconfig/rsyslog
        else
                SYSLOGD_OPTIONS="-c3"
        fi

        umask 077

        echo -n $"Starting system logger (rsyslog): "
        daemon rsyslogd $SYSLOGD_OPTIONS
        RETVAL=$?
        echo
        return $RETVAL
}
stop() {
        echo -n $"Shutting down system logger (rsyslog): "
        killproc rsyslogd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rsyslog
        return $RETVAL
}
rhstatus() {
        status rsyslogd
}
restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        rhstatus
        ;;
  restart|reload)
        restart
        ;;
  condrestart)
        [ -f /var/lock/subsys/rsyslog ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart}"
        exit 2
esac

exit $?
User avatar
sandiso
New
 
Posts: 7
Joined: Wed May 07, 2008 9:03 am

Postby mbiebl on Wed May 07, 2008 3:01 pm

lograte has a nice function, called postrotate:

Code: Select all
var/log/syslog
{
        rotate 7
        daily
        missingok
        notifempty
        delaycompress
        compress
        postrotate
                /etc/init.d/rsyslog reload > /dev/null
        endscript
}


No need for a separate cron job
mbiebl
Avarage
 
Posts: 17
Joined: Wed Dec 05, 2007 12:46 am

Google Ads



Return to Installation

Who is online

Users browsing this forum: No registered users and 1 guest

cron