0

我正在尝试使用 graylog2 从 docker 容器中收集日志。Docs 说为此目的仅支持 UDP GELF 输入。我正在使用 docker-compose 来运行 graylog 服务器。请参阅所有使用的文件的要点:https ://gist.github.com/olegabr/7f5190c453bb63c71dabf151d2373c2f 。

我正在使用这个命令来测试它: sendip -p ipv4 -is 127.0.0.1 -p udp -us 5070 -ud 12201 -d '{"version": "1.1","host":"example.org","short_message":"Short message","full_message":"Backtrace here\n\nmore stuff","level":1,"_user_id":9001,"_some_info":"foo","_some_env_var":"bar"}' -v 127.0.0.1

服务器收到此消息,但无法处理。我在 graylog2 日志中看到以下内容: 2016-12-09 11:53:20,125 WARN : org.graylog2.bindings.providers.DefaultStreamProvider - Unable to load default stream, tried 1 times, retrying every 500ms. Processing is blocked until this succeeds. 2016-12-09 11:53:25,129 WARN : org.graylog2.bindings.providers.DefaultStreamProvider - Unable to load default stream, tried 11 times, retrying every 500ms. Processing is blocked until this succeeds.

等等许多类似的行。

API 调用curl http://admin:123456@127.0.0.1:9000/api/count/total返回 {"events":0}

在服务器日志中,我看到默认流已初始化: mongo_1 | 2016-12-09T11:51:12.522+0000 I INDEX [conn3] build index on: graylog.pipeline_processor_pipelines_streams properties: { v: 2, unique: true, key: { stream_id: 1 }, name: "stream_id_1", ns: "graylog.pipeline_processor_pipelines_streams" } graylog_1 | 2016-12-09 11:51:13,408 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.plugins.pipelineprocessor.periodical.LegacyDefaultStreamMigration] periodical, running forever. graylog_1 | 2016-12-09 11:51:13,424 INFO : org.graylog.plugins.pipelineprocessor.periodical.LegacyDefaultStreamMigration - Legacy default stream has no connections, no migration needed. graylog_1 | 2016-12-09 11:51:13,487 INFO : org.graylog2.migrations.V20160929120500_CreateDefaultStreamMigration - Successfully created default stream: All messages graylog_1 | 2016-12-09 11:51:13,653 INFO : org.graylog2.migrations.V20161125142400_EmailAlarmCallbackMigration - No streams needed to be migrated. graylog_1 | 2016-12-09 11:51:13,662 INFO : org.graylog2.migrations.V20161125161400_AlertReceiversMigration - No streams needed to be migrated. graylog_1 | 2016-12-09 11:51:13,672 INFO : org.graylog2.migrations.V20161130141500_DefaultStreamRecalcIndexRanges - Cluster not connected yet, delaying migration until it is reachable.

那么,为什么消息到达时无法加载呢?为什么首先需要它?

我试图在网络上找到类似的报告,但没有成功。

4

2 回答 2

0

这与 UDP 输入本身无关。

Graylog 2.2.0-beta.1 已损坏,不应使用。请降级到 Graylog 2.1.2(最新稳定版本)或等待 Graylog 2.2.0-beta.2。

有关 Graylog 邮件列表上的相关帖子,请参阅https://groups.google.com/forum/#!searchin/graylog2/docker|sort:date/graylog2/gCycC3_K3vU/EL-Lz_uNDQAJ

于 2016-12-09T13:51:44.307 回答
-1

同样的麻烦只是设置graylog并配置输入gelf udp 12209端口

然后通过以下方式对其进行两次测试:

docker run --log-driver=gelf --log-opt gelf-address=udp://127.0.0.1:12209 busybox echo Hello Graylog

在 UI 我看到:

2 条消息正在处理缓冲区中 2 条未处理的消息当前在日志中,分 1 段。上一秒附加了 0 条消息,上一秒读取了 0 条消息。

仍然得到:

2016-12-09 12:41:23,715 信息:org.graylog2.inputs.InputStateListener - 输入 [GELF UDP/584aa67308813b00010d009e] 现在正在运行 2016-12-09 12:41:43,666 警告:org.graylog2.bindings.providers。 DefaultStreamProvider - 无法加载默认流,尝试了 1 次,每 500 毫秒重试一次。处理被阻止,直到成功为止。

有人找到解决方案了吗?

于 2016-12-09T12:56:34.377 回答