【问题标题】:Add custom fields to source of the JSON in metricbeat将自定义字段添加到 metricbeat 中的 JSON 源
【发布时间】:2018-03-15 17:10:53
【问题描述】:

我知道我们可以在 metricbeat.yml 文件中添加自定义字段,

fields:
  customfield1: value1
  customfield2: value2

然后 JSON 输出将生成为,

{
  "@timestamp": "2018-03-15T17:00:04.392Z",
  "@metadata": {
    "beat": "metricbeat",
    "type": "doc",
    "version": "6.2.2"
  },
  "metricset": {
    "rtt": 801,
    "name": "status",
    "module": "kibana",
    "host": "localhost:5601"
  },
  "error": {
    "message": "error making http request: Get http://localhost:5601/api/status: dial tcp [::1]:5601: getsockopt: connection refused"
  },
  "fields": {
    "customfield1": "value1",
    "customfield2": "value2"
  },
  "beat": {
    "name": "TheNameOfBeat",
    "hostname": "localhost",
    "version": "6.2.2"
  }
}

但我想将自定义字段添加到 JSON 消息的来源,而不是“字段”对象内。这可能吗?

类似的,

{
      "@timestamp": "2018-03-15T17:00:04.392Z",
      "customfield1": "value1",
      "customfield2": "value2",
      "@metadata": {
        "beat": "metricbeat",
        "type": "doc",
        "version": "6.2.2"
      },
      "metricset": {
        "rtt": 801,
        "name": "status",
        "module": "kibana",
        "host": "localhost:5601"
      },
      "error": {
        "message": "error making http request: Get http://localhost:5601/api/status: dial tcp [::1]:5601: getsockopt: connection refused"
      },
      "beat": {
        "name": "TheNameOfBeat",
        "hostname": "localhost",
        "version": "6.2.2"
      }
    }

【问题讨论】:

    标签: metricbeat


    【解决方案1】:

    How can I parse custom Metricbeat dictionary for Kibana?找到解决方案 需要将 fields_under_root 选项设置为 true

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-25
      • 2019-01-01
      • 1970-01-01
      • 2013-11-07
      • 1970-01-01
      • 1970-01-01
      • 2018-02-24
      • 2015-03-26
      相关资源
      最近更新 更多