设为首页收藏本站

LinuxTone | 运维专家网论坛 - 最棒的Linux运维与开源架构技术交流社区!

 找回密码
 注册

用新浪微博连接

一步搞定

QQ登录

只需一步,快速开始

查看: 1346|回复: 0

[日志分割回滚] syslog-ng 通过udp 发送日志出现重复日志问题 [复制链接]

Rank: 6Rank: 6

签到
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 配置文件如下
  1. source s_nginx {  pipe ("/tmp/fifo.log" ); };
  2. template t_demo_filetemplate {
  3. template("$MSG\n"); template_escape(no); };

  4. destination d_local {
  5. file("/tmp/2.log" template(t_demo_filetemplate)); };

  6. #source s_nginx { udp(ip(0.0.0.0) port(1234)); };

  7. #destination d_nginx { pipe ("/tmp/fifo.log"); };
  8. destination d_nginx { udp("192.168.56.102" port(1234)  ); };
  9. #log { source(s_nginx); filter(f_default); destination(d_nginx);};
  10. log { source(s_nginx); destination(d_nginx); destination(d_local); };
复制代码
server 端 syslog-ng
  1. source s_nginx { udp(ip(0.0.0.0) port(1234)); };
  2. template t_demo_filetemplate {
  3. template("$MSG\n"); template_escape(no); };

  4. destination d_local {
  5. file("/tmp/2.log" template(t_demo_filetemplate)); };
  6. #destination d_nginx { file("/tmp/2.log"); };

  7. log { source(s_nginx);filter(f_default); destination(d_local);};  
复制代码



您需要登录后才可以回帖 登录 | 注册

IT运维专家网感谢红之盟网络提供带宽支持

合作联系: QQ:67888954/MSN:cnseek@msn.com/mail:netseek@linuxtone.org

Archiver|手机版|感谢所有关心和支持过LinuxTone的朋友们 转载本站内容请注明原作者名及出处 ( 京ICP备08103151 )   |

GMT+8, 2012-5-22 21:01 , Processed in 0.107664 second(s), 12 queries , Memcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部