Elasticsearch Filebeat文档类型已弃用

问题描述 投票:2回答:1

我目前正在使用ELK 5.5。现在看来document_type现已在Filebeats中弃用了,但我现在无法找到任何关于如何实现相同的示例。

这是我在日志中得到的:

WARN DEPRECATED: document_type is deprecated. Use fields instead.

这是我目前的文件配置:

- 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时重写我的日志并删除此弃用消息。顺便说一句,我确实想对两种“文档类型”使用相同的ES索引。

elasticsearch filebeat
1个回答
3
投票

而不是使用document_type,你可以在Filebeat上使用像这样的fields

- 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输出过滤器,您可以使用[type]而不是使用[service]来调用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

© www.soinside.com 2019 - 2024. All rights reserved.