From 18bd9097fab9c2fb96a52ade1f77cb2c0e09fdcb Mon Sep 17 00:00:00 2001
From: "abby.huang" <78209557+abby-cyber@users.noreply.github.com>
Date: Fri, 13 Oct 2023 15:21:57 +0800
Subject: [PATCH] print slow query to log files (#3045)
* print slow query to log files
* Update 3.graph-config.md
* comment fix
* Update 3.graph-config.md
---
.../1.configurations/3.graph-config.md | 2 +-
.../5.configurations-and-logs/2.log-management/audit-log.md | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs-2.0/5.configurations-and-logs/1.configurations/3.graph-config.md b/docs-2.0/5.configurations-and-logs/1.configurations/3.graph-config.md
index 8cc810ba85..76f141b442 100644
--- a/docs-2.0/5.configurations-and-logs/1.configurations/3.graph-config.md
+++ b/docs-2.0/5.configurations-and-logs/1.configurations/3.graph-config.md
@@ -77,7 +77,7 @@ Graph 服务提供了两份初始配置文件`nebula-graphd.conf.default`和`neb
| `ws_http_port` | `19669` | HTTP 服务的端口。 |不支持|
|`heartbeat_interval_secs` | `10` | 默认心跳间隔。请确保所有服务的`heartbeat_interval_secs`取值相同,否则会导致系统无法正常工作。单位:秒。 |支持|
|`storage_client_timeout_ms`|-| Graph 服务与 Storage 服务的 RPC 连接超时时间。初始配置文件中未设置该参数,使用需手动添加。默认值为`60000`毫秒。|不支持|
-|`enable_record_slow_query`|`true`|是否启用慢查询记录。注:企业版功能。|不支持|
+|`enable_record_slow_query`|`true`|是否启用慢查询记录。注:企业版功能。
当将其设置为`true`时,如果查询的执行时间超过`slow_query_threshold_us`定义的时间,{{nebula.name}}会将该查询记录到日志文件中。
同时,`graphd`进程的内存中会缓存最近的几条慢查询,其缓存条数由`slow_query_limit`定义。缓存的慢查询可以通过 HTTP 接口获取。|不支持|
|`slow_query_limit`|`100`|慢查询记录的最大条数。注:企业版功能。|不支持|
|`slow_query_threshold_us`|`200000`|定义超过多长时间的查询为慢查询。单位:微秒。|不支持|
|`ws_meta_http_port`|`19559`|HTTP 协议监听 Meta 服务的端口,需要和 Meta 服务配置文件中的`ws_http_port`保持一致。|不支持|
diff --git a/docs-2.0/5.configurations-and-logs/2.log-management/audit-log.md b/docs-2.0/5.configurations-and-logs/2.log-management/audit-log.md
index 6d1c9852fb..3e22ba524e 100644
--- a/docs-2.0/5.configurations-and-logs/2.log-management/audit-log.md
+++ b/docs-2.0/5.configurations-and-logs/2.log-management/audit-log.md
@@ -161,8 +161,8 @@
|`missingok`| 如果日志文件丢失,不报告错误。|
|`notifempty`| 如果日志文件为空,不进行轮转。|
|`create 644 root root`| 创建新的日志文件,并设置适当的权限和所有者。|
- |`dateext`| 在日志文件名中添加日期后缀。
默认是当前日期。默认是`-%Y%m%d`的后缀。可用`dateformat`选项扩展配置。|
- |`dateformat .%Y-%m-%d-%s`| 必须配合`dateext`使用,紧跟在下一行出现,定义文件切割后的文件名。
在V3.9.0 之前,只支持`%Y`、`%m`、`%d`、`%s`参数。在V3.9.0 及之后,支持 %H 参数。
**注意**:文件名称中禁止出现分号(:) ,因为文件名称不能含有分号。|
+ |`dateext`| 在日志文件名中添加日期后缀。
默认是当前日期。默认是`-%Y%m%d`的后缀。可用`dateformat`选项扩展配置。|
+ |`dateformat .%Y-%m-%d-%s`| 必须配合`dateext`使用,紧跟在下一行出现,定义文件切割后的文件名。
在V3.9.0 之前,只支持`%Y`、`%m`、`%d`、`%s`参数。在V3.9.0 及之后,支持 %H 参数。|
|`maxsize 1k`| 当日志文件大小超过`1`千字节(`1024`字节)或者超过设定的周期(如`daily`)时,进行日志轮转。可用的大小单位有:`k`、`M`,默认单位为字节。|
用户可以根据实际需求修改配置文件中的参数。更多关于参数的配置及解释,参见 [logrotate](https://man7.org/linux/man-pages/man8/logrotate.8.html)。