[英]How to configure JBoss JsonFormatter for Filebeat (WildFly 14)
I have Filebeat pulling logs from stdout. 我有Filebeat从标准输出中提取日志。 I want to ensure my logs are outputted as JSON, so they can be properly parsed.
我想确保我的日志输出为JSON,以便可以对其进行正确解析。
Thus far, here's what I've found: 到目前为止,这是我发现的内容:
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush,target
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=JSON-FORMATTER
handler.CONSOLE.target=SYSTEM_OUT
formatter.JSON-FORMATTER=org.jboss.logmanager.ext.formatters.JSONFormatter
I need to know: 我需要知道:
There is a json-formatter
in WildFly 14. I would not suggest editing the logging.properties
. WildFly 14中有一个
json-formatter
程序。我不建议编辑logging.properties
。 The following CLI commands are an example of configuring a json-formatter
. 以下CLI命令是配置
json-formatter
的示例。
/subsystem=logging/json-formatter=json:add(exception-output-type=formatted, pretty-print=false, meta-data={label=value})
/subsystem=logging/console-handler=CONSOLE:write-attribute(name=named-formatter, value=json)
Note the meta-data
attribute is just a key/value pair separated by commas. 请注意,
meta-data
属性只是一个键/值对,以逗号分隔。
How can I customise the JSON output (ie add or remove fields)?
如何自定义JSON输出(即添加或删除字段)?
You can really only add metadata or change field names. 您实际上只能添加元数据或更改字段名称。 You can't remove fields though.
但是您不能删除字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.