Chinaunix首页 | 论坛 | 博客
  • 博客访问: 120772
  • 博文数量: 13
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 189
  • 用 户 组: 普通用户
  • 注册时间: 2013-04-05 17:00
文章分类

全部博文(13)

文章存档

2017年(1)

2013年(12)

我的朋友

分类: LINUX

2013-05-16 16:06:32

环境:

  • OS:sles11sp2
  • Server IP : 192.168.1.1
  • sysadmin邮箱:sysadmin@abc.com        

目标:

  • 1台log server,其他的都是log client。
  • log cliens会将它的所有log发送给log server。
  • log server会将需要发送给root的邮件转发到sysadmin的邮箱中。

解决方案:

log client 端

  1. 修改 /etc/syslog-ng/syslog-ng.conf


  1. # vi /etc/syslog-ng/syslog-ng.conf

  2. +# Setup the remote logging destination 

  3. +destination loghost {
  4. +udp ( "192.168.1.1" port(514)); #输入server的ip和端口
  5. +};

  6. +# Send everything to the remote loghost
  7. +log {
  8. +source(src); destination(loghost);
  9. +};

      2. 然后重启syslog,  rcsyslog restart

log server 端

  1. 修改 /etc/syslog-ng/syslog-ng.conf
    1. source src {
    2. #
    3. # include internal syslog-ng messages
    4. # note: the internal() soure is required!
    5. #
    6. internal();

    7. #
    8. # the following line will be replaced by the
    9. # socket list generated by SuSEconfig using
    10. # variables from /etc/sysconfig/syslog:
    11. #
    12. unix-dgram("/dev/log");

    13. #
    14. # uncomment to process log messages from network:
    15. #
    16. +udp(ip("0.0.0.0") port(514));

    17. +tcp(port(514)
    18. +max-connections(500) );
    19. };

  2. 重启syslog, rcsyslog restart
  3. 修改 /etc/aliases文件使发到root的邮件还会发送到sysadmin的邮箱中
    1. #vi /etc/aliases
    2. +root: sysadmin@abc.com, \root # "\root"表示原本发给root的邮件除了发给sysadmin,还是要发给root

  4. 具体的邮件配置文件为/etc/postfix/main.cf,可以配置host_relay,一些配置文件的路径。
阅读(914) | 评论(0) | 转发(0) |
0

上一篇:书签

下一篇:Q&A

给主人留下些什么吧!~~