Skip to content

Commit cfa7f1b

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents c29af8c + 76cd8d5 commit cfa7f1b

4 files changed

Lines changed: 195 additions & 105 deletions

File tree

content/en/altinity-kb-setup-and-maintenance/altinity-kb-system-tables-eat-my-disk.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,21 @@ $ cat /etc/clickhouse-server/config.d/z_log_disable.xml
4747
</clickhouse>
4848
```
4949

50-
**We do not recommend removing `query_log` and `query_thread_log` as queries' (they have very useful information for debugging), and logging can be easily turned off without a restart through user profiles:**
50+
Hint: `z_log_disable.xml` is named with **z_** in the beginning, it means this config will be applied the last and will override all other config files with these sections (config are applied in alphabetical order).
51+
52+
**We do not recommend removing `query_log` as it has very useful information for debugging, and logging can be easily turned off without a restart through user profiles:**
5153

5254
```markup
5355
$ cat /etc/clickhouse-server/users.d/z_log_queries.xml
5456
<clickhouse>
5557
<profiles>
5658
<default>
5759
<log_queries>0</log_queries> <!-- normally it's better to keep it turned on! -->
58-
<log_query_threads>0</log_query_threads>
59-
<log_processors_profiles>0</log_processors_profiles>
6060
</default>
6161
</profiles>
6262
</clickhouse>
6363
```
6464

65-
Hint: `z_log_disable.xml` is named with **z_** in the beginning, it means this config will be applied the last and will override all other config files with these sections (config are applied in alphabetical order).
66-
6765
You can also configure these settings to reduce the amount of data in the `system.query_log` table:
6866

6967
```markup
@@ -77,6 +75,27 @@ log_query_settings | 1 | Log query settings into the qu
7775
log_queries_probability | 1 | Log queries with the specified probabality.
7876
```
7977

78+
The other system log tables that can be disabled in profiles are:
79+
* query_views_log
80+
* query_thread_log
81+
* processors_profile_log
82+
* query_metric_log
83+
* trace_log (https://clickhouse.com/docs/operations/system-tables/trace_log)
84+
85+
```markup
86+
$ cat /etc/clickhouse-server/users.d/z_log_tables.xml
87+
<clickhouse>
88+
<profiles>
89+
<default>
90+
<log_query_views>0</log_query_views>
91+
<log_query_threads>0</log_query_threads>
92+
<log_processors_profiles>0</log_processors_profiles>
93+
<query_metric_log_interval>0</query_metric_log_interval>
94+
</default>
95+
</profiles>
96+
</clickhouse>
97+
```
98+
8099
## You can configure TTL
81100

82101
Example for `query_log`. It drops partitions with data older than 14 days:
@@ -133,25 +152,3 @@ $ cat /etc/clickhouse-server/config.d/query_log_ttl.xml
133152
💡 For the [clickhouse-operator](https://github.com/Altinity/clickhouse-operator/blob/master/README.md), the above method of using only the `<engine>` tag without `<ttl>` or `<partition>` is recommended, because of possible configuration clashes.
134153

135154
After that you need to restart ClickHouse and *if using old clickhouse versions like 20 or less*, drop or rename the existing system.query_log table and then CH creates a new table with these settings. This is automatically done in newer versions 21+.
136-
137-
138-
## You can disable logging on a session level or in user’s profile (for all or specific users)
139-
140-
But only for logs generated on session level (`query_log` / `query_thread_log`)
141-
142-
In this case a restart is not needed.
143-
144-
Let’s disable query logging for all users (profile = default, all other profiles inherit it).
145-
146-
```markup
147-
cat /etc/clickhouse-server/users.d/log_queries.xml
148-
<clickhouse>
149-
<profiles>
150-
<default>
151-
<log_queries>0</log_queries>
152-
<log_query_threads>0</log_query_threads>
153-
<log_processors_profiles>0</log_processors_profiles>
154-
</default>
155-
</profiles>
156-
</clickhouse>
157-
```

0 commit comments

Comments
 (0)