EFK安裝與建置(4/4) 前提: EFK是三個opensource組成,透過三個軟體的搭配去監控與分析資料。 為了蒐集不同類型與格式的log,進行資料的轉換(ETL),將數據呈現在不同的圖型上。 可以針對log去做監控和分析及記錄。 **安裝順序:1-1.Elasticsearch和1-2.Kibana -> 2.td-agent -> 3.curator** 我們會先安裝Elasticsearch和Kibana並把服務起起來,可以進入elastic後台之後,再去安裝和起td-agent服務,透過td-agent抓到log餵給elastic,最後透過curator去管理elastic的索引。 9. 10. 11. 10 14. td-agent介紹 主要結構是<source> 和 <match **> <source>是取得log的來源,像是Debug Agent、HTTP port、forward <match **>是針對資料做正則,決定輸出到哪裡,像是寫進file、塞到Database、餵給Elasticsearch 15. td-agent接收資料的方式 %vi /etc/td-agent/td-agent.conf 預設有三種接收方式 1.透過Debug Agent使用本機的方式去 <source> @type debug_agent bind 127.0.0.1 port 24230 </source> 2.HTTP port接收 <source> @type http port 8888 </source> 3.接收別的td-agent傳進來 <source> @type forward </source> 16. td-agent把資料傳送出去的方式 1.自己是client 傳給 log server <match **> @type forward <server> name elastic-db host log-server port 24224 </server> </match> 2.儲存到db裡 <match **> @type mongo database lodge collection fluentd capped capped_size 100m host 127.0.0.1 port 27017 user <MONGO_USER> password <MONGO_PASS> time_key time </match> 3.餵給elasticsearch <match **> @type elasticsearch host localhost port 9200 index_name fluentd type_name log </match> 17. 來源是吃本地log,餵給elasticsearch的實作範例 <source> @type tail path /var/log/test1.log pos_file /var/log/td-agent/test1.log.pos tag td.test <parse> @type json </parse> </source> <match **> @type elasticsearch host localhost port 9200 index_name fluentd type_name log </match> 18. 相關指令 重啟 systemctl restart td-agent 啟動 systemctl start td-agent 把檔案丟到log server範例 https://hackmd.io/@efknice/Bk37NCBSI 相關文章(待補充) Td-agent去接 elasticSearch https://blog.toright.com/posts/5133/%E7%94%A8-elasticsearch-fluentd-%E6%89%93%E9%80%A0-log-%E7%A5%9E%E5%99%A8%E8%88%87%E6%95%B8%E6%93%9A%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7.html Td-agent設定 https://blog.idcf.jp/entry/elasticsearch1#%E3%83%AD%E3%82%B0%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E9%80%81%E4%BF%A1 https://blog.yeshuanova.com/2019/12/fluentd_basic/ https://blog.csdn.net/qq_43812373/article/details/113859513 ------------------- https://blog.toright.com/posts/5133/%E7%94%A8-elasticsearch-fluentd-%E6%89%93%E9%80%A0-log-%E7%A5%9E%E5%99%A8%E8%88%87%E6%95%B8%E6%93%9A%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7.html#Log_%E7%9A%84%E5%A5%BD%E6%9C%8B%E5%8F%8B_Fluentd https://blog.idcf.jp/entry/elasticsearch1#%E3%83%AD%E3%82%B0%E3%83%87%E3%83%BC%E3%82%BF%E3%81%AE%E9%80%81%E4%BF%A1 https://blog.yeshuanova.com/2019/12/fluentd_basic/ https://cloud.tencent.com/developer/article/1642145 https://blog.bimap.com.tw/2021/06/07/fluentd-basic-concept https://blog.toright.com/posts/5133/%E7%94%A8-elasticsearch-fluentd-%E6%89%93%E9%80%A0-log-%E7%A5%9E%E5%99%A8%E8%88%87%E6%95%B8%E6%93%9A%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7.html#google_vignette
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up