2016-08-03 293 views
0

我使用帶有ES的filebeat作爲輸出。我指定了: input_type:log document_type:apache 路徑: -/var/log/httpd/* _ log 位於/etc/filebeat/filebeat.yml中,我能夠在Kibana中成功查看結果。 然而,我正在玩「Watcher」,並試圖創建一個基於HTTP返回代碼404的手錶,我看到沒有字段在我的Kibana filebeat結果中對應於並且僅對應於「404」,例如「響應」,恐怕我錯過了一些東西,因爲filebeat和ELK都是BIG產品,希望能有幫助。filebeat中的Apache響應字段名稱

回答

0

Filebeat會在每個事件的message字段中「按原樣」轉發日誌行。爲了進一步處理消息以將響應代碼等細節提取到它們自己的字段中,可以使用Logstash。

在Logstash中,您將使用beats input從Filebeat接收數據,然後應用grok filter解析消息中的數據,最後使用elasticsearch輸出將數據寫入Elasticsearch。

0

使用Logstash的另一種方法是使用「Ingest Node」,並在Elasticsearch中使用合適的管道。

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

您可以建立一個管道包括神交處理器:

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' [email protected] 

最後,我更新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。

我絕對看到領域的迴應,引薦,響應等