2014-11-02 36 views

回答

0

使用類似奇蹟的東西,您可以查看這種類型的數據 - 儘管它不是特定於logstash的 - 它通常都是索引。基礎數據可通過_stats/indexing網址獲得,但您需要做一些工作才能使其可用。你需要進行輪詢,然後計算增量,並按輪詢之間的間隔除以每秒的速率。

例如:

curl -s http://localhost:9200/_stats/indexing 

返回數據是這樣的:

"_all" : { 
    "primaries" : { 
    "indexing" : { 
     "index_total" : 98241849, 
     "index_time_in_millis" : 23590766, 
     "index_current" : 1, 
     "delete_total" : 8, 
     "delete_time_in_millis" : 4, 
     "delete_current" : 0 
    } 
    }, 
    "total" : { 
    "indexing" : { 
     "index_total" : 195892197, 
     "index_time_in_millis" : 46639803, 
     "index_current" : 2707, 
     "delete_total" : 16, 
     "delete_time_in_millis" : 14, 
     "delete_current" : 0 
    } 
    } 
... 
+0

太好了,謝謝! – deez 2014-11-04 08:04:31

0

的logstash文檔建議使用所謂的 「度量」 過濾器插件,以生成該信息。我個人而言,使用輸出插件「文件」,該結果從管道

下面分開是the documentation提供的示例:

input { 
    generator { 
    type => "generated" 
    } 
} 

filter { 
    if [type] == "generated" { 
    metrics { 
     meter => "events" 
     add_tag => "metric" 
    } 
    } 
} 

output { 
    # only emit events with the 'metric' tag 
    if "metric" in [tags] { 
    stdout { 
     codec => line { 
     format => "rate: %{[events][rate_1m]}" 
     } 
    } 
    } 
}