1

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

4

2 回答 2

1

使用 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 就可以工作。

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

于 2016-11-24T16:32:49.097 回答
1

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

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

于 2016-08-03T19:37:38.467 回答