无论才能、知识多么卓著,如果缺乏热情,则无异纸上画饼充饥,无补于事。

慢日志全局级别设定

Elasticsearch | 作者 printf_uck | 发布于2019年01月23日 | 阅读数:2890

如题,有一个问题,我看官网说慢日志是针对索引级别的,当然我们也可以设定模板,在模板里设定规则,针对某一类的索引预先设定慢日志等信息;但是有个问题是有么有全局的慢日志设定API,即所有的索引都默认预先设定好慢日志等。
以下的语句测试通过,
PUT /_settings
{
"index.search.slowlog.level": "debug,trace",            
"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
}
但是新建一个索引,查看该索引的setting信息,并没有这些设定值,请问这是什么意思?
已邀请:

fanmo3yuan

赞同来自: printf_uck

1. 对已经存在的索引可以通过  PUT _settings 做存量设置
2. 对之后新增的索引,可以使用类似于下面的template
PUT _template/global-slowlog_template
{
"order": -1,
"version": 0,
"template": "*",
"settings": {
"index.indexing.slowlog.threshold.index.debug" : "10ms",
"index.indexing.slowlog.threshold.index.info" : "50ms",
"index.indexing.slowlog.threshold.index.warn" : "100ms",
"index.search.slowlog.threshold.fetch.debug" : "100ms",
"index.search.slowlog.threshold.fetch.info" : "200ms",
"index.search.slowlog.threshold.fetch.warn" : "500ms",
"index.search.slowlog.threshold.query.debug" : "100ms",
"index.search.slowlog.threshold.query.info" : "200ms",
"index.search.slowlog.threshold.query.warn" : "1s"
}
}
注意,"order": -1,  "template": "*"

zqc0512 - andy zhou

赞同来自:

这是修改老的,都走template了。
 

printf_uck - 1024

赞同来自:

TIM截图20181209174043.png

如图

zqc0512 - andy zhou

赞同来自:

try indexxxxxxxx/_settings 

zqc0512 - andy zhou

赞同来自:

try /_all/_settings  
not recommend to change this.
 

要回复问题请先登录注册