hi all :<br><br>I have stoped rsyslog service , and the following program is used to listen on 'dev/log'<br><br>after rsyslog stoped type this command in shell : $ logger write this mesg to var/log/syslog <br><br>
this msg can't write to var/log/syslog anymore <br><br><br>after run # python devlog.py ,but i got an error like this :<br><br><b><font size="2"> " twisted.internet.error.CannotListenError: Couldn't listen on any:/dev/log: [Errno 98] Address already in use " </font></b><br>
<br><br># ps aux|grep syslog <br><br>there is no syslog process runing <br><br>my system is ubuntu9.10 there is no process named syslogd --that's the very process i want make it stop <br><br><br>$ ps aux|grep syslog<br>
root 4656 0.0 0.0 1852 548 ? Ss 11:24 0:00 dd bs=1 if=/proc/kmsg of=/var/run/rsyslog/kmsg<br>syslog 4658 0.0 0.0 33184 1244 ? Sl 11:24 0:00 rsyslogd -c4<br>1000 4663 0.0 0.0 3040 800 pts/1 R+ 11:24 0:00 grep --color=auto syslog<br>
<br><br># service rsyslog stop <br><br>$ ps aux|grep syslog<br><br>1000 4647 0.0 0.0 3040 800 pts/1 S+ 11:24 0:00 grep --color=auto syslog<br><br><br>this code is supose to makesure logger still can write log message to /var/log/syslog after syslogd stoped <br>
<br><br><br>i don't know why <b><font size="2">Address already in use</font></b> since the rsyslog service is not running anymore <br><br>I'm I stoped the wrong service ? or listening on the wrong <b><span class="code-string"></span></b> <b><span class="code-string">unix socket ?</span></b> <br>
<br><br><br>need help ...<br><br><br><br># devlog.py <br><br>from twisted.internet.protocol import DatagramProtocol, Factory<br>from twisted.internet import reactor<br><br><br>class LogProtocol(DatagramProtocol):<br> def datagramReceived(self, datagram):<br>
sys.stdout.write(datagram) <br><br>class SysLogFactory(Factory):<br> protocol = LogProtocol<br><br>logprotocol = LogProtocol()<br><br><br>reactor.listenUNIXDatagram('/dev/log', logprotocol) <br>reactor.run()<br>
<br><br>