2015-04-23 62 views
1
  1. 我試圖把我的日誌,通過對logstash elasticsearch。
  2. logstash.conf有2個日誌文件作爲輸入;彈性搜索作爲輸出;和grok作爲過濾器。這裏是我的神交比賽:任何人都可以提供一個REST API列表來查詢elasticsearch嗎?

    grok { 
        match => [ "message", "(?<timestamp>[0-9]{4}-[0-9]{2}-[0-9]{2} 
    [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}) 
    (?:\[%{GREEDYDATA:caller_thread}\]) (?:%{LOGLEVEL:level}) 
    (?:%{DATA:caller_class})(?:\-%{GREEDYDATA:message})" ] 
        } 
    
  3. 當elasticsearch開始時,我的所有日​​志添加爲logstash.conf提到elasticsearch服務器配有獨立的索引名。

  4. 我的疑問是,我的日誌是如何存儲在elasticsearch中的?我只知道它與logstash中提到的索引名稱一起存儲。

'http://164.99.178.18:9200/_cat/indices?v' API給我以下:

健康狀況指標PRI代表docs.count docs.deleted store.size pri.store.size

yellow open tomcat-log  5 1  6478   0  1.9mb   1.9mb 

yellow open apache-log  5 1  212   0  137kb 
    137kb 
  • 但是,在我的日誌的elasticsearch中如何創建」文檔「,」字段「。
  • ,我讀了elasticsearch是基於REST的搜索引擎。因此,如果有任何REST API可用於在elasticsearch中分析我的數據。

    +0

    參考http://stackoverflow.com/questions/1323449/tool-to-measure-render-time – BlackPOP

    回答

    3

    確實。

    curl localhost:9200/tomcat-log/_search 
    

    會給你回頭的10個文件,但也是你的索引文件的總數。

    curl localhost:9200/tomcat-log/_search -d '{ 
        "query": { 
        "match": { 
         "level" : "error" 
        } 
        } 
    }' 
    

    可能會給你所有的文檔在tomcat日誌中有等級的錯誤。

    看一看book的這一部分。我會幫你的。

    +0

    是的,我會將curl localhost:9200/tomcat-log/_mapping添加到工具箱以及映射索引中的所有字段。 –

    相關問題