2016-11-25 7 views
0

私はApacheのアクセスログをLogstashから解析し、Elasticsearchインデックスにインデックスを付けます。私はまた、geoipagentフィールドをインデックスしました。インデックス作成中に私はelasticsearchインデックスサイズが実際のファイルサイズ(ディスク上のスペース)よりも大きい6.7xであることを観察しました。だから私はこれが正しい動作であることを理解したいのですか、ここで何か間違っていますか?私はElasticsearch 5.0,Logstash 5.0Kibana 5.0バージョンを使用しています。私もbest_compressionを試しましたが、同じディスクサイズを使用しています。これまでに試した設定ファイルの完全な観察結果を示します。Elasticsearch best_compressionが機能しない

私の観察:

ユースケース1:

Apache Log file Size:211メガバイト
Total number of lines:1,000,000
Index Size:1.5GB
Observation:インデックスはファイルサイズよりも大きい6.7xです。

ユースケース2:

私はその後、私は同様にそれを試してみました、elasticsearchインデックスを圧縮するためにいくつかの解決策を発見しました。

- Disable `_all` fields 
- Remove unwanted fields that has been created by `geoip` and `agent` parsing. 
- Enable `best_compression` [ index.codec": "best_compression"] 

Apache Log file Size:211メガバイト
Total number of lines:1,000,000
Index Size:1.3ギガバイト
Observation

127.0.0.1 - - [24/Nov/2016:02:03:08 -0800] "GET /wp-admin HTTP/1.0" 200 4916 "http://trujillo-carpenter.com/" "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 5.01; Trident/5.1)" 

I:インデックスは、ファイルサイズ

ログファイル形式よりも6.16x大きいです見つけたLogstash + Elasticsearch Storage Experients彼らはsayiです彼らは、インデックスサイズを6.23xから1.57xに減らしました。しかし、それはかなり古いソリューションであり、これらのソリューションはもはやElasticsearch 5.0で動作していません。

いくつかのより多くの参照私はすでに試してみました:
- Part 2.0: The true story behind Elasticsearch storage requirements
- https://github.com/elastic/elk-index-size-tests

あなたの目的にのみKibanaの可視化を示しているときElasticseachインデックスのサイズを最適化するために任意のより良い方法はありますか?

答えて

0

インデックス設定がインデックスに適用されていないため、この問題に直面していました。私のインデックス名とテンプレート名が異なっていました。同じテンプレート名とインデックス名を使用した後、圧縮が正しく適用されます。

以下の例では、インデックス名apache_access_logsとテンプレート名elk_workshopを使用していました。

修正されたテンプレートとログの設定を共有しています。

Logstash.conf

output { 
    elasticsearch { 
    hosts => ["localhost:9200"] 
    index => "apache_access_logs" 
    template => "apache_sizing_2.json" 
    template_name => "apache_access_logs" /* it was elk_workshop */ 
    template_overwrite => true 
    } 
} 

テンプレート:

{ 

    "template": "apache_access_logs", /* it was elk_workshop */ 
    "settings": { 
     "index.refresh_interval": "5s", 
     "index.refresh_interval": "30s", 
     "number_of_shards": 5, 
     "number_of_replicas": 0 
    }, 
    .. 
}   

参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html#indices-templates

関連する問題