2015-10-22 36 views
0

我已經設置了非常類似於描述here的fluentd/elasticsearch/kibana堆棧。當我查看kibana中的日誌時,我注意到它們是使用格式「logstash- [YYYY]。[MM]。[DD]」自動索引的。根據fluentd elasticsearch plugin的文檔,您似乎可以創建一個自定義索引通過設置「index_name」屬性Fluentd高可用性定製索引

我已經在日誌轉發器和日誌聚合器上試過這個,但我似乎仍然在elasticsearch中得到默認索引名稱還有其他需要自定義此索引名稱在HA設置

這裏是日誌轉發配置:

<source> 
    type tail 
    path /var/log/debug.json 
    pos_file /var/log/debug.pos 
    tag asdf 
    format json 
    index_name fluentd 
    time_key time_field 
</source> 

<match *> 
    type copy 
    <store> 
    type stdout 
    </store> 
    <store> 
    type forward 
    flush_interval 10s 
    <server> 
     host [fluentd aggregator] 
    </server> 
    </store> 
</match> 

這裏是日誌骨料或配置:

<source> 
    type forward 
    port 24224 
    bind 0.0.0.0 
</source> 

<match *> 
    type copy 
    <store> 
    type stdout 
    </store> 
    <store> 
    type elasticsearch 
    host localhost 
    port 9200 
    index_name fluentd 
    type_name fluentd 
    logstash_format true 
    include_tag_key true 
    flush_interval 10s # for testing 
    </store> 
</match> 

回答

0

刪除logstash_format爲true。您將得到您的自定義索引。但是您不會在您的數據中獲得時間戳。對於獲取時間戳,您必須更新ruby版本,然後將時間格式傳遞給配置fluentd文件。