我從Logstash
解析Apache訪問日誌並將其索引到Elasticsearch
索引中。我也索引了geoip
和agent
字段。索引時,我觀察到elasticsearch索引大小爲6.7x
大於實際文件大小(磁盤空間)。所以我只想了解這是正確的行爲還是我在這裏做錯了什麼?我正在使用Elasticsearch 5.0
,Logstash 5.0
和Kibana 5.0
版本。我也試過best_compression,但它的磁盤大小相同。以下是我迄今嘗試過的配置文件的完整觀察。Elasticsearch best_compression不起作用
我的觀察:
使用案例1:
Apache Log file Size
:211 MB
Total number of lines
:1,000,000
Index Size
:1.5 GB
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 MB
Total number of lines
:人民幣100
Index Size
:1.3 GB
Observation
:指數大於文件大小
日誌文件格式6.16x
更大:
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)"
我發現Logstash + Elasticsearch Storage Experients他們是sayi ng他們已經從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
有沒有什麼更好的方法來優化Elasticseach索引大小時,你的目的是隻顯示在Kibana可視化?