ElasticSearch之Slow Log
ElasticSearch的慢日志,相关的参数及配置方法。
在log4j2.properties中配置慢日志的输出文件名。
Search Slow Log
相关参数
index.search.slowlog.threshold.query.warnindex.search.slowlog.threshold.query.infoindex.search.slowlog.threshold.query.debugindex.search.slowlog.threshold.query.traceindex.search.slowlog.threshold.fetch.warnindex.search.slowlog.threshold.fetch.infoindex.search.slowlog.threshold.fetch.debugindex.search.slowlog.threshold.fetch.trace
上述参数的默认值均为-1,即关闭日志的输出。
参数值为时长,单位如下:
s,即秒,样例:10s。ms,即毫秒,样例:10ms。
修改各参数的时长,命令样例,如下:
curl -X PUT "https://localhost:9200/testindex_001/_settings?pretty" -H 'Content-Type: application/json' -d'
{
"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",
"index.search.slowlog.threshold.fetch.warn": "1s",
"index.search.slowlog.threshold.fetch.info": "800ms",
"index.search.slowlog.threshold.fetch.debug": "500ms",
"index.search.slowlog.threshold.fetch.trace": "200ms"
}
' --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
执行结果的样例,如下:
{
"acknowledged" : true
}
查看上述参数的当前值,命令样例,如下:
curl -X GET "https://localhost:9200/testindex_001/_settings?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
执行结果的样例,如下:
{
"testindex_001" : {
"settings" : {
"index" : {
"routing" : {
"allocation" : {
"include" : {
"_tier_preference" : "data_content"
}
}
},
"search" : {
"slowlog" : {
"threshold" : {
"fetch" : {
"warn" : "1s",
"trace" : "200ms",
"debug" : "500ms",
"info" : "800ms"
},
"query" : {
"warn" : "10s",
"trace" : "500ms",
"debug" : "2s",
"info" : "5s"
}
}
}
},
"number_of_shards" : "1",
"provided_name" : "testindex_001",
"merge" : {
"scheduler" : {
"max_thread_count" : "2"
}
},
"creation_date" : "1701354456991",
"number_of_replicas" : "1",
"uuid" : "7iGJRFfxRd2jD3qP-KDRmQ",
"version" : {
"created" : "8500003"
}
}
}
}
}
Index Slow log
相关参数
index.indexing.slowlog.threshold.index.warn
index.indexing.slowlog.threshold.index.info
index.indexing.slowlog.threshold.index.debug
index.indexing.slowlog.threshold.index.trace
上述参数的默认值均为-1,即关闭日志的输出。
参数值为时长,单位如下:
s,即秒,样例:10s。ms,即毫秒,样例:10ms。
index.indexing.slowlog.source,指定在日志中记录数据中_source时的长度,默认值为1000。
false或者0,记录日志时跳过_source字段。true,记录日志时完整记录_source字段。- 非零值,记录日志时截取
_source字段的部分。
index.indexing.slowlog.reformat,输出日志时,对_source做格式化操作,默认值为true。
true,对_source做格式化操作。false,不对_source做格式化操作。
修改各参数的时长,命令样例,如下:
curl -X PUT "https://localhost:9200/testindex_001/_settings?pretty" -H 'Content-Type: application/json' -d'
{
"index.indexing.slowlog.threshold.index.warn": "10s",
"index.indexing.slowlog.threshold.index.info": "5s",
"index.indexing.slowlog.threshold.index.debug": "2s",
"index.indexing.slowlog.threshold.index.trace": "500ms",
"index.indexing.slowlog.source": "1000"
}
' --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
执行结果的样例,如下:
{
"acknowledged" : true
}
查看上述参数的当前值,命令样例,如下:
curl -X GET "https://localhost:9200/testindex_001/_settings?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
执行结果的样例,如下:
{
"testindex_001" : {
"settings" : {
"index" : {
"routing" : {
"allocation" : {
"include" : {
"_tier_preference" : "data_content"
}
}
},
"indexing" : {
"slowlog" : {
"threshold" : {
"index" : {
"warn" : "10s",
"trace" : "500ms",
"debug" : "2s",
"info" : "5s"
}
},
"source" : "1000"
}
},
"number_of_shards" : "1",
"provided_name" : "testindex_001",
"merge" : {
"scheduler" : {
"max_thread_count" : "2"
}
},
"creation_date" : "1701354456991",
"number_of_replicas" : "1",
"uuid" : "7iGJRFfxRd2jD3qP-KDRmQ",
"version" : {
"created" : "8500003"
}
}
}
}
}
控制日志级别
从前述配置方法可以发现,当前慢日志没有提供参数用于控制日志级别。
但可以通过关闭低级别的日志,从而模拟对日志级别的控制。
比如当前只希望记录INFO级别以上的日志,则可以执行如下日志,关闭debug和trace。
curl -X PUT "https://localhost:9200/testindex_001/_settings?pretty" -H 'Content-Type: application/json' -d'
{
"index.indexing.slowlog.threshold.index.debug": "-1",
"index.indexing.slowlog.threshold.index.trace": "-1"
}
' --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
相关资料
ElasticSearch之Slow Log的更多相关文章
- jdbc autoReconnect=true 参数设置导致 slow log 爆表。
1.过程 同事按照文档上配置了下面的jdbc url: jdbc:mysql://ip:port/db?autoReconnect=true&useUnicode=true&chara ...
- redis专题--slow log详解
SLOWLOG subcommand [argument] 什么是 SLOWLOG Slow log 是 Redis 用来记录查询执行时间的日志系统. 查询执行时间指的是不包括像客户端响应(talki ...
- mysql slow log分析工具的比较
mysql 中的 slow log 是用来记录执行时间较长(超过 long_query_time 秒)的 sql 的一种日志工具. 启用 slow log 在 my.cnf 中设置 [mysqld] ...
- mysql之 slow log 慢查询日志
一. 相关参数: • slow_query_log ◦ 是否开启慢查询日志 • slow_query_log_file ◦ 慢查询日志文件名, 在 my.cnf 我们已经定义为slow.log,默认是 ...
- Mysq性能分析 —— Genral log(普通日志)与 Slow log(慢速日式)
对Mysql进行深入的分析对于发现mysql性能瓶颈和寻找优化策略是十分必要的. 我们可以从不同的粒度上对Mysql进行分析:可以整体分析服务器,或者检查单个查询或批查询.通过分析,我们得到的如下信息 ...
- 【PHP】善用php-fpm的慢执行日志slow log,分析php性能问题
(转)善用php-fpm的慢执行日志slow log,分析php性能问题 众所周知,mysql有slow query log,根据慢查询日志,我们可以知道那些sql语句有性能问题.作为mysql的好 ...
- Genral log(普通日志)与 Slow log(慢速日式)
General log: Geleral log记录了服务器接收到的每一个查询或是命令,无论这些查询或是命令是否正确甚至是否包含语法错误,general log 都会将其记录下来 ,记录的格式为 {T ...
- 正确安全清空在线慢查询日志slow log的流程 (转)
1, see the slow log status; mysql> show variables like '%slow%'; +---------------------+--------- ...
- MySQL Slow Log慢日志分析【转】
如果你的MySQL出现了性能问题,第一个需要“诊断”的就是slow log(慢日志)了. slow log文件很小,使用more less等命令就足够了.如果slow log很大怎么办?这里介绍MyS ...
- MySQL-慢日志slow log
文件结构 1.目录结构 drwxrwxr-x mysql mysql Mar bin drwxrwxr-x mysql mysql Dec : binlogdir -rw-r--r-- mysql m ...
随机推荐
- Vue3搭建后台管理系统模板
搭建后台管理系统模板 2.1项目初始化 今天来带大家从0开始搭建一个vue3版本的后台管理系统.一个项目要有统一的规范,需要使用eslint+stylelint+prettier来对我们的代码质量做检 ...
- 我看懂了oracle中pivot行转列的用法
我看懂了PIVOT的用法 用法Select * From 表名,PIVOT( SUM('要合并的列1'),MAX('要合并的列2'),....FOR 将值转换成列的列名 IN(列名1,列名2,列名3 ...
- android studio error
Invalid method receiver.: Invalid method receiver.java.lang.IllegalStateException: Invalid method re ...
- P8741 [蓝桥杯 2021 省 B] 填空问题 题解
P8741 [蓝桥杯 2021 省 B] 填空问题 题解 题目传送门 欢迎大家指出错误并联系这个蒟蒻 更新日志 2023-05-09 23:19 文章完成 2023-05-09 23:20 通过审核 ...
- 实验四报告: 熟悉Python字典、集合、字符串的使用
实验目标 本实验的主要目标是熟悉Python中字典.集合.字符串的创建和操作,包括字典的创建.访问.修改和合并,集合的创建.访问以及各种集合运算,以及字符串的创建.格式化和常用操作. 实验要求 通过编 ...
- 【BUU刷题日记】——第一周
[BUU刷题日记]--第一周 一.[极客大挑战 2019]PHP1 题目说自己有一个备份网站的习惯,所以要了解一下常见的网站源码备份格式及文件名: 格式:tar.tar.gz.zip.rar 文件名: ...
- 云图说|初识API中心APIHub
阅识风云是华为云信息大咖,擅长将复杂信息多元化呈现,其出品的一张图(云图说).深入浅出的博文(云小课)或短视频(云视厅)总有一款能让您快速上手华为云.更多精彩内容请单击此处. 摘要:API中心是为AP ...
- c# 引入同一个版本dll(比如包含opencv不同模块的dll,但是版本却是一致的)
1.使用dnSpy.exe工具,打开相关dll 在左侧"管理器"中选中并点击右键 2.在弹出菜单中点击编辑程序集 3.更改名称和版本号 4.工具栏-文件-全部保存 5.在VS中引入 ...
- 实战|如何低成本训练一个可以超越 70B Llama2 的模型 Zephyr-7B
每一周,我们的同事都会向社区的成员们发布一些关于 Hugging Face 相关的更新,包括我们的产品和平台更新.社区活动.学习资源和内容更新.开源库和模型更新等,我们将其称之为「Hugging Ne ...
- Ubuntu22.04 rc-local 配置开机自启动脚本
1. rc-local服务简介Linux中的rc-local服务是一个开机自动启动的,调用开发人员或系统管理员编写的可执行脚本或命令的,它的启动顺序是在系统所有服务加载完成之后执行. ubuntu22 ...