ELK-logstash案例實戰之讀取日志輸出到elasticsearch


簡介:從日志文件中讀取日志,輸出到elasticsearch集群中

$ cd /home/es/logstash-6.2.2/config $ vim test3_es.conf $ cd /home/es/logstash-6.2.2/bin $ ./logstash -f ../config/test3_es.conf #注意:先成功啟動es,否則可能報錯

 

test3_es.conf內容如下:

input { file { path => "/home/es/elasticsearch-6.2.2/logs/elasticsearch.log" type => "elasticsearch" start_position => "beginning" #從文件開始處讀寫 } } output{ elasticsearch { hosts=>["127.0.0.1:9200"] index => "es-message-%{+YYYY.MM.dd}" #對日志進行索引歸檔 } stdout{codec => rubydebug} }

 

驗證
查看索引列表 curl http://localhost:9200/_cat/indices?v
查看數據 curl http://localhost:9200/es-message-2019.04.20/_search?pretty


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM