LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 08-02-2007, 11:24 AM   #1
shinepuppy
LQ Newbie
 
Registered: Sep 2002
Location: Lewisville, Texas
Distribution: Debian / [K]Ubuntu
Posts: 13

Rep: Reputation: 0
fedora - syslog not creating socket file


Greetings All!
Syslog's -a option allows it to listen on multiple socket files. So for example, if I want syslog to listen on /dev/log (the standard socket file) as well as /tmp/custom.log the command would look something like this:
Code:
/sbin/syslogd -a /tmp/custom.log
The expected result is for syslog to do it's normal thing as well as create the /tmp/custom.log socket if it doesn't exist and go about it's business. When I run the command manually from the command line, syslog obediently creates the socket specified and everything works fantastically. I've added the appropriate configuration details to /etc/sysconfig/syslog but when I issue /etc/init.d/syslog restart, syslog seems to completely disregard my socket file and does not create it. When I run a process listing I see the following:
Code:
ps waux | grep syslog
root     18674  0.0  0.0   1612   572 ?        Ss   10:45   0:00 syslogd -a /tmp/custom.log
As you can see, the process was run with my flag and argument but syslog just seems to disregard the information. Here is a clip of my /etc/sysconfig/syslog:
Code:
SYSLOGD_OPTIONS="-a /tmp/custom.log"
Here is a clip of the /etc/init.d/syslog file:
Code:
#!/bin/bash
#
# syslog        Starts syslogd/klogd.
#
#
# chkconfig: 2345 12 88
# description: Syslog is the facility by which many daemons use to log \
# messages to various system log files.  It is a good idea to always \
# run syslog.
### BEGIN INIT INFO
# Provides: $syslog
### END INIT INFO

# Source function library.
. /etc/init.d/functions

[ -f /sbin/syslogd ] || exit 0
[ -f /sbin/klogd ] || exit 0

# Source config
if [ -f /etc/sysconfig/syslog ] ; then
        . /etc/sysconfig/syslog
else
        SYSLOGD_OPTIONS="-m 0"
        KLOGD_OPTIONS="-2"
fi

RETVAL=0

umask 077

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

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

exit $?

Again, if I were to copy the executed line from the process listing and run it manually as root on the command line everything works as expected. Can anyone shed some light on this problem?

thanks!
 
Old 08-02-2007, 11:50 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: OpenSUSE 12.1 CentOS 6.2
Posts: 9,007

Rep: Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349
Just an idea: have you a unique SYSLOGD_OPTIONS= entry in /etc/sysconfig/syslog?
 
Old 08-02-2007, 11:57 AM   #3
shinepuppy
LQ Newbie
 
Registered: Sep 2002
Location: Lewisville, Texas
Distribution: Debian / [K]Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Hey, thanks for the reply. Yup, there are only two uncommented lines in the /etc/sysconfig/syslog file:
Code:
# Options to syslogd
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
SYSLOGD_OPTIONS="-a /tmp/log"
# Options to klogd
# -2 prints all kernel oops messages twice; once for klogd to decode, and
#    once for processing with 'ksymoops'
# -x disables all klogd processing of oops messages entirely
# See klogd(8) for more details
KLOGD_OPTIONS="-x"
The init script does include the sysconfig file and it seems to execute the the binary with my specified arguments. I'm guessing there's something in the init script that is causing syslog to bork somewhere. Maybe an environment variable or something?? ugh!

thanks!
 
Old 08-02-2007, 12:13 PM   #4
shinepuppy
LQ Newbie
 
Registered: Sep 2002
Location: Lewisville, Texas
Distribution: Debian / [K]Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 0
Hmm. It looks like fedora's 'daemon' bash function is doing something wacky with these binaries. I made the following changes and syslog is working as expected now:

Code:
#daemon syslogd $SYSLOGD_OPTIONS
syslogd $SYSLOGD_OPTIONS

...

#daemon klogd $KLOGD_OPTIONS
klogd $KLOGD_OPTIONS
 
Old 08-02-2007, 12:45 PM   #5
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: OpenSUSE 12.1 CentOS 6.2
Posts: 9,007

Rep: Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349
Good news! BTW I cannot figure out an explanation of this behaviour... the daemon command in /etc/init.d/syslog should have worked! Probably a kind of bug on Fedora. Bye.
 
  


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FC4: Error creating netlink socket jakubi Fedora 3 07-10-2006 12:29 PM
Syslog-ng File Separation MrJoshua Linux - Software 2 06-16-2006 09:46 AM
decode my syslog file epoo Slackware 6 04-04-2005 06:30 PM
creating server socket program to handle multiple client at same time cranium2004 Programming 2 03-14-2005 10:58 AM
Creating socket programs as daemon cranium2004 Programming 2 03-04-2005 04:42 AM


All times are GMT -5. The time now is 12:13 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration