|
|

楼主 |
发表于 2006-2-23 12:41:51
|
显示全部楼层
呵呵 多谢帮助,我的问题想到方法解决了。两个不会冲突,只会启用一个另一个自动不记录。
后来找了很多档案,找到了方法在syslog-ng中记录本机记录。
#----------------------------------------------------------------------
options { long_hostnames(off); sync(0); create_dirs(yes);};
#----------------------------------------------------------------------
# Piping method
#----------------------------------------------------------------------
destination d_mysql {
pipe("/tmp/mysql.pipe"
template("INSERT INTO logs (host, facility, priority, level, tag, date, time, program, msg) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY', '$HOUR MIN SEC', '$PROGRAM', '$MSG' );\n") template-escape(yes));
};
log { source(net); destination(d_mysql);};
#上面这段是保存网络里传过来信息的
#下面是保存本机log的
###########################################################################
source s_sys { pipe ("/proc/kmsg" log_prefix("kernel: ")); unix-stream ("/dev/log"); internal(); };
source s_net {tcp(ip(210.51.7.113)port(514));udp(); };
destination d_mysql { pipe("/tmp/mysql.pipe" template("INSERT INTO logs (host, facility, priority, level, tag, date, time, program, msg) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$YEAR-$MONTH-$DAY', '$HOUR MIN SEC', '$PROGRAM', '$MSG' );\n") template-escape(yes)); };
log { source(s_sys); source(s_net); destination(d_mysql); };
#############################################################################
#指定记录设备和传输方式
source src { unix-stream("/dev/log"); internal(); };
source net { udp(); }; |
|