【问题标题】:Elasticsearch Filebeat document type deprecated issueElasticsearch Filebeat 文档类型已弃用问题
【发布时间】:2017-12-23 02:35:17
【问题描述】:

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

【问题讨论】:

    标签: elasticsearch filebeat


    【解决方案1】:

    您可以在 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-25
      • 2013-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-01
      • 1970-01-01
      相关资源
      最近更新 更多