你好,游客 登录 注册 搜索
背景:
阅读新闻

maptail同时监控多台web访问日志

[日期:2013-04-03] 来源:Linux社区  作者:luoweiro [字体:大 中 小]

五、拓展使用inotify+rsync实现同时监控多台主机

1.安装inotify

  1. # tar xf inotify-tools-3.14.tar.gz
  2. # cd inotify-tools-3.14
  3. # ./configure && make && make install

2.配置:

192.168.158.219 ====> 192.168.158.216

219上的配置:

  1. # vim /root/scripts/in_rsync.sh
  2. #!/bin/bash
  3. host1=192.168.158.216
  4. src=/usr/local/apache/logs/web
  5. dst1=weblog219
  6. user1=root
  7. /usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e modify,delete,create,attrib $src \
  8. | while read files;do
  9. /usr/bin/rsync -zrtopg --delete --password-file=/etc/rsyncd.pass $src $user1@$host1::$dst1 >/dev/null 2>&1
  10. echo "${files} was rsynced" >>/tmp/rsync.log 2>&1 >/dev/null
  11. done
  12. # vim /etc/rsyncd.pass
  13. 123456
  14. # chmod 600 /etc/rsyncd.pass
  15. # nohup /root/scripts/in_rsync.sh &

216上的配置:

  1. # vim /etc/rsyncd.conf
  2. uid = root
  3. gid = root
  4. use chroot = no
  5. max connections = 36000
  6. strict modes = yes
  7. log file = /var/log/rsyncd.log
  8. pid file = /var/run/rsyncd.pid
  9. lock file = /var/run/rsync.lock
  10. log format = %t %a %m %f %b
  11. [weblog219]
  12. path = /www/log219/
  13. auth users = root
  14. read only = no
  15. hosts allow = 192.168.158.0/24
  16. list = no
  17. uid = root
  18. gid = root
  19. secrets file = /etc/rsyncd.pass
  20. ignore errors = yes
  21. # vim /etc/rsyncd.pass
  22. root:123456
  23. # chmod 600 /etc/rsyncd.pass
  24. # /usr/bin/rsync --daemon

六、启动新端口并验证

nohup /usr/bin/tail -f /var/log/httpd/access_log | /usr/local/bin/node /usr/local/bin/maptail -h 192.168.158.216 -p 8219 &

在浏览器中输入http://192.168.158.216:8080和http://192.168.158.216:8219查看

linux
相关资讯       maptail 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款