kibana 中文本内字段的平均值

average of a field inside of a text in kibana

我在 kibana 中有一些日志,其中包含以下消息:

message: '{ "Type": "successfully created", "Count": 6, "ElapsedTime": 2004, "Id": "189f6293-21a1-4a74-a332-34369a0ebd0d"}'

我如何使用 timelion 创建一个显示 ElapsedTime 平均值的图表?

您必须从消息字段中提取 fields/json-keys。

消息字段本身是文本类型,这意味着您可以对其进行全文搜索。为了使用 ElapsedTime 的值来构建可视化,它必须是文档中自己的字段,类型为整数或关键字。

如果您使用 Logstash,则可以使用 json filter plugin 设置管道。它将提取消息字段内的 JSON 对象,并将键值对作为单独的字段存储在 event/document.