Skip to content

Add ClickHouse logging

charlie ablett requested to merge 421530-cablett-clickhouse-logs into master

What does this MR do and why?

Adds ClickHouse logger so that queries are visible via the logfile.

How to set up and validate locally

Make sure you have GitLab Ultimate license on your local.

  1. Install and run the ClickHouse server as per these directions 👉 !124295 (merged)
  • If you do the one-line install rather than installing via apt, you can remove the password from the yml file because the default user it comes with doesn't have a password. There is a way to set up other users or set a password, but for the purposes of testing I don't think it's necessary.

I did:

cd clickhouse # directory where I installed clickhouse
./clickhouse server

Then make sure this branch is checked out.

Run the following:

tail -f %gdk_dir/gitlab/log/clickhouse.log

(if it doesn't exist, you may need to touch it)

In rails console, run ClickHouse::Client.select('SELECT 1', :main)

charlie@failbox gitlab % tail -f log/clickhouse.log
{"severity":"INFO","time":"2023-08-30T04:05:26.956Z","correlation_id":<some stuff>,"query":"SELECT 1"}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #421530 (closed)

Edited by charlie ablett

Merge request reports