syslog-ng 正确配置udp接受端口

今天花了半天的时间捣鼓syslog-ng,还有所收获

基本上可以通过一个配置文件学会配置, 运行时可以使用-f 指定特定的配置文件实现LOG

问题出在udp端口上,总是出现synax error

最后正常的格式是这个:

udp("0.0.0.0" port(4445));

附上一份conf文件 ,留着以后对比

---------------------------------------------------------------

options {
    chain_hostnames(off);
    log_msg_size(1024);
    sync(0);
    };

source src {
    unix-stream("/dev/log" max-connections(256));
    internal();
    };

filter f_key_log { match("tag:key_log_");};
filter f_no_key_log { not match("tag:key_log_");};
destination msg { file("/var/log/messages");};
destination host0 { udp("0.0.0.0" port(4445));};
log {source(src);filter(f_no_key_log);destination(host0);};
log {source(src); filter(f_no_key_log); destination(msg);};

其中UDP很关键,要使用"IP" port()结构

posted @ 2012-08-03 18:56  阿毛小猪  阅读(4353)  评论(0编辑  收藏  举报