2017-08-30 193 views
0

您好我一直在使用彈性堆棧進行自動日誌記錄。我有filebeat正在從路徑中讀取日誌,輸出設置爲通過端口5044的logstash。 logstash配置有一個輸入,它監聽5044並輸出推送到localhost:9200。問題是我無法讓它工作,我不知道發生了什麼。下面是這些文件:無法將Filebeat連接到logstash以使用ELK進行日誌記錄

我filebeat.yml路徑:etc/filebeat/filebeat.yml

#=========================== Filebeat prospectors ============================= 

filebeat.prospectors: 

# Each - is a prospector. Most options can be set at the prospector level, so 
# you can use different prospectors for various configurations. 
# Below are the prospector specific configurations. 

- input_type: log 

# Paths that should be crawled and fetched. Glob based paths. 
paths: 
- /mnt/vol1/autosuggest/logs/*.log 
#- c:\programdata\elasticsearch\logs\* 
<other commented stuff> 
#----------------------------- Logstash output -------------------------------- 
output.logstash: 
# The Logstash hosts 
hosts: ["10.10.XX.XX:5044"] 

# Optional SSL. By default is off. 
<other commented stuff> 

我logstash.yml路徑:etc/logstash/logstash.yml

<other commented stuff> 
path.data: /var/lib/logstash 
<other commented stuff> 
path.config: /etc/logstash/conf.d 
<other commented stuff> 

# ------------ Metrics Settings -------------- 
# 
# Bind address for the metrics REST endpoint 
# 
http.host: "10.10.XX.XX" 
# 
# Bind port for the metrics REST endpoint, this option also accept a range 
# (9600-9700) and logstash will pick up the first available ports. 
# 
# http.port: 9600-9700 
<other commented stuff> 
path.logs: /var/log/logstash 
<other commented stuff> 

我logpipeline30aug.config文件路徑:/usr/share/logstash

input { 
    beats { 
    port => 5044 
    } 
} 

filter { 
    grok { 
match => { "message" => "\A%{TIMESTAMP_ISO8601:timestamp}%{SPACE}%{WORD:var0}%{SPACE}%{NOTSPACE}%{SPACE}(?<searchinfo>[^#]*)#(?<username>[^#]*)#(?<searchQuery>[^#]*)#(?<latitude>[^#]*)#(?<longitude>[^#]*)#(?<client_ip>[^#]*)#(?<responseTime>[^#]*)" } 
    } 
} 

output { 
    elasticsearch { 
     hosts => ["http://localhost:9200"] 
     index => "logstash30aug2017" 
     document_type => "log" 
    } 
} 

請注意: Elasticsearch,logstash,filebeat都安裝在同一臺機器上使用IP:10.10.XX.XX和我檢查防火牆,這不是問題是肯定的。

我檢查logstash,filebeat服務都在運行。 Filebeat可以在配置時將數據推送到elasticsearch,logstash可以在配置時將數據推送到elasticsearch。


也許這是我如何執行過程中的問題.. 我在做一個/usr/share/logstashbin/logstash -f logpipeline30aug.config啓動它,然後我從根目錄/etc/init.d/filebeat start

請注意:格式可能會影響由於StackOverflow的格式問題

是否有人可以幫忙嗎?自3天以來,我一直在嘗試一切,我也瀏覽了文檔

回答

1

您的filebeat.yml看起來無效。

輸出部分缺乏一個缺口:

output.logstash: 
    hosts: ["10.10.XX.XX:5044"] 

一般情況下,檢查配置文件的正確性,以確保它們正常。

例如,對於filebeat,你可以運行:

filebeat -c /etc/filebeat/filebeat.yml -configtest 

如果您有任何錯誤,它解釋了什麼是錯誤,所以你可以修復它。

您可以使用其他ELK服務類似的方法,以及

+0

它的存在,這是一個計算器格式問題 –

+0

什麼filebeat的輸出? – whites11

+0

什麼都沒有發生 –