Elasticsearch Filebeat 文档类型弃用问题

Elasticsearch Filebeat document type deprecated issue

我目前使用的是 ELK 5.5。看来 document_type 现在已在 Filebeats 中弃用,但我现在无法在任何地方找到有关如何实现相同功能的任何示例。

这是我在日志中得到的:

WARN DEPRECATED: document_type is deprecated. Use fields instead.

这是我当前的 filebeat 配置:

- input_type: log

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - C:\inetpub\logs\LogFiles\*\*
  document_type: iislog

  paths:
    - C:\MyApp\logs\*
  document_type: applog

有人可以告诉我如何在使用相同的 5.5 版时重写我的日志并删除此弃用消息。顺便说一句,我确实想对 "document types".

使用相同的 ES 索引

您可以在 Filebeat 上使用 fields,而不是使用 document_type

- input_type: log

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - C:\inetpub\logs\LogFiles\*\*
  fields:
    service: iislog
  fields_under_root: true 

  paths:
    - C:\MyApp\logs\*
  fields:
    service: applog
  fields_under_root: true

现在,对于 Logstash 输出过滤器,您可以使用 [service] 而不是使用 [type] 调用 document_type。这是我在 logstash 上的使用方式:

output {
  if [service] == "applog" {   
    elasticsearch {
    hosts => ["localhost:9200"]
    user => <user>
    password => <pass>
    index => "applog-%{+YYYY.MM.dd}"
    }   
  }
enter code here

查看下面有关 Filebeat 自定义字段的更多信息: https://www.elastic.co/guide/en/beats/filebeat/current/migration-changed-fields.html