- 注册时间
- 2009-7-3
- 最后登录
- 2012-3-1
- 在线时间
- 23 小时
- 阅读权限
- 70
- 积分
- 1975
- 帖子
- 21
- 主题
- 5
- 精华
- 0
- UID
- 3981
 
 - 签到
- 39
- 注册时间
- 2009-7-3
- 最后登录
- 2012-3-1
- 在线时间
- 23 小时
- 阅读权限
- 70
- 积分
- 1975
- 帖子
- 21
- 主题
- 5
- 精华
- 0
- UID
- 3981
|
发表于 2011-7-20 15:20:22
|显示全部楼层
各位大大,我在配置集中日志服务器
我的思路是通过管道在传送nginx日志到本地的同时,也通过udp 传送到日志服务器上 用于awstats分析。现遇到的问题是
我设置通过udp 传送时,日志是可以成功传送,但是传送到日志服务器里,日志会重复写入两次。
我发现如果把udp 传送改在TCP ,就不会发生这种情况,不知道是什么原因,请各位指教。
在nginx 里我的accessllog 地址是 /tmp/fifo.log
client 端也是syslog-ng 配置文件如下
- source s_nginx { pipe ("/tmp/fifo.log" ); };
- template t_demo_filetemplate {
- template("$MSG\n"); template_escape(no); };
- destination d_local {
- file("/tmp/2.log" template(t_demo_filetemplate)); };
- #source s_nginx { udp(ip(0.0.0.0) port(1234)); };
- #destination d_nginx { pipe ("/tmp/fifo.log"); };
- destination d_nginx { udp("192.168.56.102" port(1234) ); };
- #log { source(s_nginx); filter(f_default); destination(d_nginx);};
- log { source(s_nginx); destination(d_nginx); destination(d_local); };
复制代码 server 端 syslog-ng
- source s_nginx { udp(ip(0.0.0.0) port(1234)); };
- template t_demo_filetemplate {
- template("$MSG\n"); template_escape(no); };
- destination d_local {
- file("/tmp/2.log" template(t_demo_filetemplate)); };
- #destination d_nginx { file("/tmp/2.log"); };
- log { source(s_nginx);filter(f_default); destination(d_local);};
复制代码
|
|