elasticsearch:是一個基於Lucene構建的開源,分佈式,RESTful搜索引擎。設計用於雲計算中,可以達到實時搜索,穩定,可靠,快速,安裝使用方便。
html
logstash:用來收集日誌,集成各類收集日誌插件。ruby
kibana:爲 Logstash 和 ElasticSearch 提供的日誌分析的 Web 接口。bash
http://www.logstash.net/docs/1.4.2/ elasticsearch
http://www.elasticsearch.org/ 分佈式
數據格式以下:ide
2014-09-04 09:38:00 /A/B/葉隨風(yesuifeng) 192.168.168.168 hhttp://www.logstash.net/docs/index.html allowed 2014-09-04 09:38:00 /A/B/C/葉(ye) 10.10.10.10 hhttp://www.logstash.net/docs/index.html allowed 2014-09-04 09:38:00 /A/D/隨風(suifeng) 172.16.10.10 hhttp://www.logstash.net/docs/index.html allowed
建立logstash配置文件,以下:ui
input{ file{ path => "/huang/tmp/1" start_position => "beginning" } } filter{ grok{ match => { "message" => "%{MYTESTLOG}" } } } output{ elasticsearch { host => localhost } stdout { codec => rubydebug } }
logstash/patterns下建立mylog文件,內容以下:搜索引擎
MYDATE %{YEAR}[/-]%{MONTHNUM}[/-]%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND} MYUSER /[^)]*\) MYTESTLOG %{MYDATE:ndate} %{MYUSER:nuser} %{IP:uip} %{URI:nurl} %{GREEDYDATA:nother}