Skip to content

Commit 51eb090

Browse files
authored
Merge pull request #79 from Gaucho-Racing/fix/clickhouse-disable-noisy-logs
fix(clickhouse-ec2): disable text_log and lower log level in provisioning
2 parents 4532237 + 0e68bb0 commit 51eb090

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

infra/modules/clickhouse-ec2/user-data.sh.tftpl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,27 @@ EOF
6464
chown 101:101 /etc/clickhouse-server/users.d/admin.xml
6565
chmod 600 /etc/clickhouse-server/users.d/admin.xml
6666

67+
# config.d overrides — server-level settings, merged with the image's default
68+
# config.xml at startup. Stock ClickHouse ships at `trace` log level with
69+
# system.text_log enabled and no TTL; on this box text_log grew ~155 GiB in
70+
# ~2 days and filled the data volume, after which every INSERT failed with
71+
# NOT_ENOUGH_SPACE (Code 243). Lower the level and disable text_log so the
72+
# server can't log itself to death on a fresh boot / image bump.
73+
mkdir -p /etc/clickhouse-server/config.d
74+
75+
cat >/etc/clickhouse-server/config.d/quiet-logs.xml <<'EOF'
76+
<clickhouse>
77+
<logger>
78+
<level>information</level>
79+
</logger>
80+
<text_log remove="1"/>
81+
</clickhouse>
82+
EOF
83+
84+
# Readable by the container's clickhouse uid 101 (no secrets here, so unlike
85+
# admin.xml this stays world-readable rather than chmod 600).
86+
chown 101:101 /etc/clickhouse-server/config.d/quiet-logs.xml
87+
6788
# --network=host: nothing else on this box uses 8123 or 9000, so skip the
6889
# docker-proxy NAT layer. --restart=always: container survives reboots
6990
# (docker.service is enabled above). --ulimit nofile=262144: ClickHouse
@@ -76,4 +97,5 @@ docker run -d \
7697
--ulimit nofile=262144:262144 \
7798
-v /var/lib/clickhouse:/var/lib/clickhouse \
7899
-v /etc/clickhouse-server/users.d:/etc/clickhouse-server/users.d:ro \
100+
-v /etc/clickhouse-server/config.d:/etc/clickhouse-server/config.d:ro \
79101
clickhouse/clickhouse-server:${clickhouse_version}

0 commit comments

Comments
 (0)