无法使用 logstash 将消息发送到 graylog 服务器

unable to send messages to graylog server using logstash

我正在使用 logstash 将消息发送到 graylog 服务器。我已经成功地将消息直接发送到 elasticsearch 或 stdout 或 loggly。我也成功地使用 cURL 将消息发送到 graylog 服务器。

curl -XPOST http://graylog.example.org:12202/gelf -p0 -d '{"short_message":"Hello there", "host":"example.org", "facility":"test", "_foo":"bar"}'

这是我使用 logstash 将数据发送到 graylog 的命令

bin/logstash -e 'input { stdin {} } output { gelf {host => "graylog.example.org" port => 12202 } }' < LOG-10

文件 LOG-10 有日志消息。我也尝试过端口 12201。我查看了来自 logstash 的调试消息,但这也没有用。

原来logstash gelf.rb不是使用TCP,而是UDP。 https://github.com/Graylog2/gelf-rb/pull/21

我必须添加 "GELF UDP" 作为 graylog 消息输入之一(负责接受日志消息)。这可以从 graylog 网络界面系统输入访问。