es学习5-slowlog

Elasticsearch支持分片级别的慢查(查询或者获取),这些记录到一个日志文件中,它有一些阀值参数设置,这些阀值是动态设置并且是针对索引设置的:

PUT http://localhost:9200/索引/_settings?pretty
{
"search.slowlog.threshold.query.warn": "1ms",
"search.slowlog.threshold.query.info": "1ms",
"search.slowlog.threshold.query.debug": "1ms",
"search.slowlog.threshold.query.trace": "1ms",
"search.slowlog.threshold.fetch.warn": "1s",
"search.slowlog.threshold.fetch.info": "800ms",
"search.slowlog.threshold.fetch.debug": "500ms",
"search.slowlog.threshold.fetch.trace": "200ms"
}

返回
{"acknowledged" : true}

 

日志打印规则已经在log4j2配置好,如果需要修改可以具体参考log4j2.properties相关设置:https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties


创建索引也有相关慢查配置:

{
"indexing.slowlog.threshold.index.warn": "10s",
"indexing.slowlog.threshold.index.info": "5s",
"indexing.slowlog.threshold.index.debug": "2s",
"indexing.slowlog.threshold.index.trace": "500ms"
}


异常相关:

开始在配置文件配置上面阀值参数,报出以下异常:node settings must not contain any index level settings

155127_Tw2T_1445156.png

描述的是es5不支持索引级别的配置,需要启动后通过接口设置,如果从es2迁移过来则这些配置需要通过接口重新设置。

 

参考:
https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-slowlog.html

转载于:https://my.oschina.net/chengxiaoyuan/blog/845634

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值