【问题标题】:Apache response field name in filebeatfilebeat 中的 Apache 响应字段名称
【发布时间】:2016-11-25 00:32:49
【问题描述】:

我正在使用带有 ES 的 filebeat 作为输出。我已经指定: 输入类型:日志 文档类型:阿帕奇 路径: - /var/log/httpd/*_log 在 /etc/filebeat/filebeat.yml 中,并且能够在 Kibana 中成功查看结果。 然而,我正在玩“Watcher”并尝试基于 404 的 http 返回码创建一个手表,我在 Kibana 文件节拍结果中没有看到与“404”相对应且仅对应于“404”的字段,类似于“响应”,我恐怕我错过了一些东西,因为 filebeat 和 ELK 是大产品,我们将不胜感激。

【问题讨论】:

    标签: elasticsearch filebeat


    【解决方案1】:

    Filebeat 在每个事件的message 字段中“按原样”转发日志行。为了进一步处理消息以将响应代码等详细信息提取到它们自己的字段中,您可以使用 Logstash。

    在 Logstash 中,您将使用 beats input 从 Filebeat 接收数据,然后应用 grok filter 解析消息中的数据,最后使用 elasticsearch 输出将数据写入 Elasticsearch。

    【讨论】:

      【解决方案2】:

      使用 Logstash 的替代方法是使用“摄取节点”和 Elasticsearch 中的合适管道。

      https://www.elastic.co/guide/en/beats/filebeat/5.0/configuring-ingest-node.html

      您可以设置一个包含 Grok 处理器的管道:

      https://www.elastic.co/guide/en/elasticsearch/reference/5.0/grok-processor.html

      我用这个pipeline.json 文件做到了这一点:

      {
        "description": "Combined Apache Log Pipeline",
        "processors": [
          {
            "grok": {
              "field": "message",
              "patterns": [ "%{COMBINEDAPACHELOG}" ]
            }
          }
        ]
      }
      

      然后我运行此命令将管道部署到集群:

      curl -XPUT 'http://node-01.example.com:9200/_ingest/pipeline/combined-apache-log' -d@pipeline.json
      

      最后,我更新了 filebeat.yml 以告诉 Elasticsearch 输出使用管道处理事件:

      #================================ Outputs =====================================
      
      #-------------------------- Elasticsearch output ------------------------------
      output.elasticsearch:
        # Array of hosts to connect to.
        hosts:
          - "192.168.0.1:9200"
          - "192.168.0.2:9200"
          - "192.168.0.3:9200"
        loadbalance: true
        pipeline: combined-apache-log
      

      这似乎不需要 Logstash 就可以工作。

      我肯定会看到响应、推荐人、响应等字段。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-11-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-01-10
        • 2016-02-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多