问题标签 [gelf]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
2376 浏览

logging - 如何使用 GELF HTTP 输入

我正在尝试设置 GrayLog2 服务器并需要使用 GELF HTTP 输入侦听器。我制作了一个小型 C# 控制台程序,它将测试日志发送到服务器。然而,gl2 似乎只解析了几条消息,我不知道为什么。例如,以下程序应创建 5 个日志 pr。第二。无论运行多长时间,Gl2 可能总共拾取 1 或 2 个日志。有没有人成功使用 GELF HTTP 输入,我在这里缺少什么?

0 投票
2 回答
7773 浏览

java - log4j2-gelf "ERROR StatusLogger appenders contains an invalid element or attribute "GELF" "

just started to get into Graylog2 and wanted to log some Java-Applications via GELF Input. Therefore I used the library log4j2 and added the graylog2-gelfclient. All dependencies are satisfied and the programm is running. But the initialisation of my Logmanager is throwing the following error:

My code is just logging an error to the logger:

and my log4j2.xml file is configured to use GELF and the GelfAppender:

Is anyone familiar with this problem? Thanks for any help.

0 投票
1 回答
4077 浏览

java - Graylog GELF 最大字段大小

我正在尝试将 Web 服务输入/输出作为 xml 插入 Graylog。为此,我使用了“GELFJ - A GELF Appender for Log4j and a GELF Handler for JDK Logging”。这是示例代码:

这就是 GELF TCP 输入属性。

在此处输入图像描述

我无法插入大于 20k(字符)的消息字段。并且消息总大小大于 1.6 MB。

我的问题是消息字段的限制和消息总大小(以字节为单位)是什么?

0 投票
2 回答
1912 浏览

logging - 错误处理元素 GELF ([Appenders: null]): CLASS_NOT_FOUND

我的 log4j2.xml 文件中出现以下错误:

起初我以为是因为我引用了一个无效的 appender,但是在注释掉之后我仍然有错误。

这是我所拥有的:

0 投票
2 回答
2160 浏览

log4j2 - 如何通过gelf将MDC转移到graylog?

我们有一个日志记录流程,我们的 java 应用程序填充一个 MDC,该 MDC 通过 log4j2 传输到 syslog 到中央 rsyslog 安装。在这里,我们广泛使用 MDC。因此,我们的设置是:

我正在尝试将其转换为使用 graylog,似乎 GELF 是推荐的传输协议。我找到了多个库来执行此操作,并从GelfLayoutlog4j2 的内置开始。但这不支持LoggerFields

那么将这些字段放入 Graylog 的推荐方法是什么?如果我做

我在 Graylog 中得到了一堆字段,但值没有扩展。

0 投票
2 回答
255 浏览

docker - 带有 UDP 输入的 Docker 中的 Graylog 2.2.0-beta.1:无法加载默认流

我正在尝试使用 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.

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

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

0 投票
1 回答
1398 浏览

docker - Docker GELF 记录附加字段

我正在尝试使用 GELF 协议让我的 docker-compose 文件将其日志记录写入 Graylog 服务器。这很好用,使用以下配置(docker-compose.yml 的片段):

Graylog 服务器接收我在 Docker 容器中登录 JBoss 实例的消息。它还添加了一些额外的 GELF 字段,例如 container_name 和 image_name。

我的问题是,我如何自己添加额外的 GELF 字段?我希望它将 _username 作为额外字段传递。我在我的 MDC 上下文中提供了这个字段。我可以通过在我的 CONSOLE 记录器中使用格式化程序(转换模式)将信息添加到消息中,方法是将以下内容添加到此记录器中:

但这不是我想要的,因为它将在 GELF 消息字段中,而不是作为单独的额外字段添加。

有什么想法吗?

0 投票
1 回答
7438 浏览

graylog2 - 如何使用graylog计算具有不同或无关字段值的消息?

我正在使用 graylog 来可视化一些 http 请求数据。我想要一个小部件,显示在给定时间范围内访问网站的不同 IPv4 地址的数量。

IPv4 地址保存在名为“ip”的字段中的日志条目中。见截图。带有 ip 字段的 Graylog 消息

我怎么能意识到这一点?下一个目标是创建一个小部件,显示在给定时间范围内每个 IP 地址记录了多少消息。

0 投票
1 回答
190 浏览

docker - GELF logging driver with Windows Containers

I'm trying get an ELK stack up (Elastic Search, Logstash and Kibana) and would like to get the GELF logging driver to forward events to Logstash, however whenever I run my container with the specified driver I get docker: Error response from daemon: logger: no log driver named 'gelf' is registered. even though I'm on 1.12.2-cs2-ws-beta. Is there a way to get this working on Windows Server 2016?

0 投票
1 回答
690 浏览

symfony - Symfony 和 ELK:我应该在 gelf 中使用哪种编码?

我正在尝试使用 ELK 堆栈监视 symfony 应用程序。

我正在使用以下配置将日志发送到 logstash:

在 kibana 上,我看到我收到了日志,但消息以一种奇怪的方式编码;这是 kibana 显示的示例:

x\x9CMP\xC1n\x830\f\xFD\u0015+\xA7V\xAAB\xA1\f(\xD7j;表示\xDD\"Ui0`)\u0004D\(\x9A\xF6\xEF\v\x9B\xD6\ xEDf\xBFg\xFB\xF9\xBD\u000F1\xE1\xE8\xA9w\xA2\u0014\xB1指令\x9Dh{ϡ\u0019\xFA\x915Y\xCF^\xDA\xDEh\e\u0018\xDF\u0006\ xEC指令\xF7\xBA\xC10\xF2\x8A5\x8E\xE8\f\xB9\u0006\xB8EP\xC2\xF4#*\u0001xct\xEBQ\xB8,@\xEC\xC1\xE9\u000EaSaM\u000E\xAB\ u0015l\x90\x9F\u0003\xB6\xD9n\x81

这是我的独白配置文件:

我尝试添加一个编码选项(charset => "UTF-8"),但效果并不好。

另外,为什么我的日志显示为“syslog”类型,而不是我在 monolog config 中指定的“gelf”?