加载中

添加主机元数据

processors:
  - add_host_metadata:
      cache.ttl: 5m
      geo:
        name: nyc-dc1-rack1
        location: 40.7128, -74.0060
        continent_name: North America
        country_iso_code: US
        region_name: New York
        region_iso_code: NY
        city_name: New York
		

它具有以下设置

netinfo.enabled
(可选)默认为 true。将 IP 地址和 MAC 地址作为 host.ip 和 host.mac 字段包含在内
cache.ttl
(可选)该处理器为主机元数据使用内部缓存。这用于设置缓存过期时间。默认值为 5m,负值则完全禁用缓存。
geo.name
(可选)用户可自定义的令牌,用于标识离散位置。通常是数据中心、机架或类似位置。
geo.location
(可选)以逗号分隔的经度和纬度格式。
geo.continent_name
(可选)大洲名称。
geo.country_name
(可选)国家名称。
geo.region_name
(可选)地区名称。
geo.city_name
(可选)城市名称。
geo.country_iso_code
(可选)ISO 国家代码。
geo.region_iso_code
(可选)ISO 地区代码。
replace_fields
(可选)默认为 true。如果设置为 false,事件中原来的 host 字段将不会被来自 add_host_metadata 的 host 字段替换。

add_host_metadata 处理器会为每个事件附加来自宿主机的相关元数据。添加到事件中的字段如下所示

{
   "host":{
      "architecture":"x86_64",
      "name":"example-host",
      "id":"",
      "os":{
         "family":"darwin",
         "type":"macos",
         "build":"16G1212",
         "platform":"darwin",
         "version":"10.12.6",
         "kernel":"16.7.0",
         "name":"Mac OS X"
      },
      "ip": ["192.168.0.1", "10.0.0.1"],
      "mac": ["00:25:96:12:34:56", "72:00:06:ff:79:f1"],
      "geo": {
          "continent_name": "North America",
          "country_iso_code": "US",
          "region_name": "New York",
          "region_iso_code": "NY",
          "city_name": "New York",
          "name": "nyc-dc1-rack1",
          "location": "40.7128, -74.0060"
        }
   }
}
		

注意:默认情况下,当 replace_fields 等于 true 时,如果 Beats 的事件中已经存在 host.* 字段,add_host_metadata 处理器将会覆盖这些 host 字段。如果该 beat 用于监控外部系统,请使用 add_observer_metadata

© . This website operates independently and is not affiliated with or endorsed by Elasticsearch B.V. All brand names, logos, and trademarks are the property of their respective owners.