clickhouse client 查看服务端查询日志
在 clickhouse client 中执行该命令后,后续查询会打印 trace
级别日志 [1]:
SET send_logs_level = 'trace';
ClickHouse 支持的日志等级有 [2]:
trace
debug
information
warning
error
例子:
9.0.16.15 :) set send_logs_level = 'trace';
SET send_logs_level = 'trace'
Query id: ca7375df-9a18-4ecf-84e4-52f0ea790628
Ok.
0 rows in set. Elapsed: 0.005 sec.
9.0.16.15 :) select 1+1;
SELECT 1 + 1
Query id: 6b84c95a-cc70-4a7d-9e9a-94b03dd0d4a5
[9.0.16.15] 2024.04.28 19:13:03.765943 [ 655261 ] {6b84c95a-cc70-4a7d-9e9a-94b03dd0d4a5} <Debug> executeQuery: (from 9.0.2.196:2407, user: monitor) select 1+1;
[9.0.16.15] 2024.04.28 19:13:03.802604 [ 655261 ] {6b84c95a-cc70-4a7d-9e9a-94b03dd0d4a5} <Trace> ContextAccess (monitor): Access granted: SELECT(dummy) ON system.one
[9.0.16.15] 2024.04.28 19:13:03.802663 [ 655261 ] {6b84c95a-cc70-4a7d-9e9a-94b03dd0d4a5} <Trace> InterpreterSelectQuery: FetchColumns -> Complete
┌─plus(1, 1)─┐
│ 2 │
└────────────┘
[9.0.16.15] 2024.04.28 19:13:03.803212 [ 655261 ] {6b84c95a-cc70-4a7d-9e9a-94b03dd0d4a5} <Information> executeQuery: Read 1 rows, 1.00 B in 0.037213644 sec., 26 rows/sec., 26.87 B/sec.
[9.0.16.15] 2024.04.28 19:13:03.803274 [ 655261 ] {6b84c95a-cc70-4a7d-9e9a-94b03dd0d4a5} <Debug> MemoryTracker: Peak memory usage (for query): 8.50 KiB.
1 rows in set. Elapsed: 0.043 sec.