try syslog-ng

version syslog-ng 3.4

http://rpmfind.net/linux/rpm2html/search.php?query=syslog-ng

options {

sync (0);
log_fifo_size (2048);
create_dirs (yes);
group (logs);
dir_group (logs);
perm (0640);
dir_perm (0750);
};

source remote { tcp(); };

source s_udp {udp ( (ip),(port) ) # 在指定的UDP端口接收日志消息

source s_tcp {tcp( (ip),(port) ) # 在指定的TCP端口接收日志消息


destination clients { file(”/var/log/HOSTS/$HOST”); };

log { source(remote); destination(clients); }; #所有的tcp连接都发向/var/log/HOST/$host 文件

重启:

syslog-ng restart

test:

import socket  
address = ('127.0.0.1', 9527)  
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
s.connect(address)  
s.send('hihi')  
s.close()



你可能感兴趣的:(try syslog-ng)