悟空,拿我的打狗棒来

elasticsearch 5.2以上如何开启慢查询日志?

Elasticsearch | 作者 chachabusi | 发布于2019年01月08日 | 阅读数:3526

收到个需求要开启 慢查询日志 我这边elastic 版本5.2 查了一下官网 提示我 在yml里配置
index.search.slowlog.threshold.query.warn:10s
index.search.slowlog.threshold.query.info:5s
index.search.slowlog.threshold.query.debug:2s
index.search.slowlog.threshold.query.trace :500ms
配置之后 启动 提示报错
Found index level settings on node level configuration.

Since elasticsearch 5.x index level settings can NOT be set on the nodes
configuration like the elasticsearch.yaml, in system properties or command line
arguments.In order to upgrade all indices the settings must be updated via the
/${index}/_settings API. Unless all settings are dynamic all indices must be closed
in order to apply the upgradeIndices created in the future should use index templates
to set default values.

Please ensure all required values are updated on all indices by executing:

curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
"index.search.slowlog.threshold.query.debug" : "2s",
"index.search.slowlog.threshold.query.info" : "5s",
"index.search.slowlog.threshold.query.trace" : "500ms",
"index.search.slowlog.threshold.query.warn" : "10s"
}'

似乎5以上不在配置文件里配置了
尝试curl

$ curl -XPUT 'http://172.16.84.179:9200/_all/_settings?preserve_existing=true' -d '{
"index.search.slowlog.threshold.query.debug" : "2s",
"index.search.slowlog.threshold.query.info" : "5s",
"index.search.slowlog.threshold.query.trace" : "500ms",
"index.search.slowlog.threshold.query.warn" : "10s"
}'
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}[ devops@172.16.84.179 ] [ /home/devops ]


请问各位大神 到底该怎么正确开启慢查询日志
已邀请:

bellengao - 博客: https://www.jianshu.com/u/e0088e3e2127

赞同来自:

curl命令增加http header参数: -H "Content-Type:application/json"

God_lockin

赞同来自:

直接用cerebro在索引上就可以操作了,如果一定要用curl的方式的话,至少报错命令上是说你的content-type不支持,建议指定为application/json
 
 

要回复问题请先登录注册