我从Logstash解析Apache日志,并将其索引到Elasticsearch索引中。我还编制了geoip和agent字段的索引。当我观察到索引时,elasticsearch索引大小比实际文件大小(磁盘上的空间)大6.7x。所以我只想明白这是正确的行为还是我做错了什么?我正在使用Elasticsearch 5.0、Logstash 5.0和Kibana 5.0版本。我也尝试过压缩,但它的磁盘大小相同。下面是我到目前为止尝试过的配置文件的完整观察。
My的观察:
用例1:
Apache Log file Size:211 MB
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 MB
Total number of lines:1 000 000
Index Size:1.3GB
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 +弹性搜索存储经验,他们说他们已经将索引大小从6.23x缩减到1.57x。但这是相当老的解决方案,这些解决方案不再适用于Elasticsearch 5.0。
我已经尝试过一些更多的参考:
是否有更好的方法来优化Elasticseach索引大小,而您的目的只是显示在Kibana上的可视化?
发布于 2016-11-30 08:56:55
由于索引设置未应用于索引,因此我面临此问题。我的索引名和模板名不同。在使用相同的模板名称和索引名称之后,将正确地应用压缩。
在下面的示例中,我使用了索引名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://stackoverflow.com/questions/40805643
复制相似问题