Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

log_* 会话设置

这些设置可在 system.settings 中找到,并由 源文件 自动生成。

log_comment

指定 system.query_log 表中 log_comment 字段的值,以及服务器日志中的注释文本。

它可用于提高服务器日志的可读性。此外,在运行 clickhouse-test 后,它还有助于从 system.query_log 中筛选与测试相关的查询。

可能的值:

  • 不超过 max_query_size 的任意字符串。如果超过 max_query_size,服务器会抛出异常。

示例

查询:

SET log_comment = 'log_comment test', log_queries = 1;
SELECT 1;
SYSTEM FLUSH LOGS;
SELECT type, query FROM system.query_log WHERE log_comment = 'log_comment test' AND event_date >= yesterday() ORDER BY event_time DESC LIMIT 2;

结果:

┌─type────────┬─query─────┐
│ QueryStart  │ SELECT 1; │
│ QueryFinish │ SELECT 1; │
└─────────────┴───────────┘

log_formatted_queries

类型
Bool
默认值
0

允许将格式化后的查询记录到 system.query_log 系统表中 (即填充 system.query_log 中的 formatted_query 列) 。

可能的值:

  • 0 — 不会将格式化后的查询记录到系统表中。
  • 1 — 会将格式化后的查询记录到系统表中。

log_processors_profiles

类型
Bool
默认值
1
版本历史
版本默认值注释
24.31默认启用

将处理器在执行过程中以及等待数据时耗费的时间写入 system.processors_profile_log 表。

另请参见:

log_profile_events

类型
Bool
默认值
1

将查询性能统计信息写入 query_log、query_thread_log 和 query_views_log。

Navigation