如何将syslog发送到graylog

时间:2016-01-20 22:03:10

标签: logging centos send syslog graylog

我们有许多Centos客户端(Centos 5-7)。我希望所有客户端通过syslog将日志发送到graylog服务器。这适用于安装了rsyslog的客户端。但是老客户没有rsyslog。他们使用syslog。

我应该在/etc/syslog.conf文件中更改哪些内容才能使其正常工作? 谢谢你的帮助。

2 个答案:

答案 0 :(得分:1)

为其他客户使用graylog-collector:

我的graylog-collector的配置:

server-url = "http://192.168.254.184:12900/"

inputs {
  win-eventlog-application {
    type = "windows-eventlog"
    source-name = "Application"
    poll-interval = "1s"
  }
  win-eventlog-system {
    type = "windows-eventlog"
    source-name = "System"
    poll-interval = "1s"
  }
  win-eventlog-security {
    type = "windows-eventlog"
    source-name = "Security"
    poll-interval = "1s"
  }
}

outputs {
  gelf-tcp {
    type = "gelf"
    host = "192.168.254.184"
    port = 12201
  }
}

只需在graylog2界面中为GELF格式创建输入!

答案 1 :(得分:0)

你使用旧的syslog还是syslog-ng?如果您使用syslog,则无法更改输出格式,但如果您使用syslog-ng,请尝试:

# Define TCP syslog destination.
destination d_net {
    syslog("graylog.example.org" port(514));
};
# Tell syslog-ng to send data from source s_src to the newly defined syslog destination.
log {
    source(s_src); # Defined in the default syslog-ng configuration.
    destination(d_net);
};