日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢(xún)
選擇下列產(chǎn)品馬上在線(xiàn)溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
Linux中安裝和使用Filebeat具體方法

Filebeat是用于轉(zhuǎn)發(fā)和集中日志數(shù)據(jù)的輕量級(jí)傳送程序。作為服務(wù)器上的代理安裝,F(xiàn)ilebeat監(jiān)視您指定的日志文件或位置,收集日志事件,并將它們轉(zhuǎn)發(fā)到Elasticsearch或Logstash進(jìn)行索引。

一、架構(gòu)圖

此次試驗(yàn)基于前幾篇文章,需要先基于前幾篇文章搭建基礎(chǔ)環(huán)境。

二、安裝Filebeat

下載并安裝Filebeat

wget  https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.0.1-x86_64.rpm
yum install ./filebeat-6.0.1-x86_64.rpm

修改Filebeat配置文件

vim /etc/filebeat/filebeat.yml                     # 主配置文件
\- type: log                                       # 文檔類(lèi)型
paths:
\- /var/log/httpd/access.log*                     # 從哪里讀入數(shù)據(jù)
# 輸出在elasticsearch與logstash二選一即可
output.elasticsearch:                           #將數(shù)據(jù)輸出到Elasticsearch。與下面的logstash二者選一
 hosts: ["localhost:9200"]
output.logstash:                               # 將數(shù)據(jù)傳送到logstash,要配置logstash使用beats接收
 hosts: ["172.18.68.14:5044"]

啟動(dòng)Filebeat

systemctl start filebeat

三、配置Filebeat

配置Logstash接收來(lái)自Filebeat采集的數(shù)據(jù)

vim /etc/logstash/conf.d/test.conf
input {
   beats {
           port => 5044                             # 監(jiān)聽(tīng)5044用于接收Filebeat傳來(lái)數(shù)據(jù)
   }
}
filter {
 grok {
match => {
 "message" => "%{COMBINEDAPACHELOG}"                 # 匹配HTTP的日志
}
remove_field => "message"                             # 不顯示原信息,僅顯示匹配后
 }
}
output {
elasticsearch {
hosts => ["http://172.18.68.11:9200","http://172.18.68.12:9200","http://172.18.68.13:9200"] # 集群IP
index => "logstash-%{+YYYY.MM.dd}"
action => "index"
document_type => "apache_logs"
}
}

啟動(dòng)Logstash

 /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/test.conf

四、模擬日志訪(fǎng)問(wèn)

通過(guò)curl命令來(lái)模擬客戶(hù)訪(fǎng)問(wèn),生成訪(fǎng)問(wèn)日志

curl 127.0.0.1
curl 172.18.68.51
curl 172.18.68.52
curl 172.18.68.53

五、驗(yàn)證信息

清除之前實(shí)驗(yàn)的舊數(shù)據(jù)(刪除時(shí)要在對(duì)話(huà)框中輸入刪除),然后可以看到filebeat采集數(shù)據(jù)經(jīng)過(guò)Logtash過(guò)濾再送給Elasticsearch的數(shù)據(jù)。

擴(kuò)展

隨著ELK日志系統(tǒng)逐漸升級(jí),現(xiàn)在已經(jīng)能基于Filebeat采集各節(jié)點(diǎn)日志,Logstash過(guò)濾、修剪數(shù)據(jù),最后到ELasticsearch中進(jìn)行索引構(gòu)建、分詞、構(gòu)建搜索引擎?,F(xiàn)在可以基于Elasticsearch的Head查看在瀏覽器中查看,但是Head僅僅能簡(jiǎn)單查看并不能有效進(jìn)行數(shù)據(jù)分析、有好展示。要想進(jìn)行數(shù)據(jù)分析、有好展示那就需要用到Kibana,Kibana依然放在下一篇文章中講解,這里先放上架構(gòu)圖。


網(wǎng)站題目:Linux中安裝和使用Filebeat具體方法
網(wǎng)站URL:http://www.dlmjj.cn/article/djecpdd.html