我从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可视化?