In this lesson we will:
- Lesson contents 1
- Lesson contents 2
- Lesson contents 3
Log Files
The ClickHouse log files are useful for debugging any issues, and actually provide a lot of information which may help you resolve users queries. By default, the log files are stored in the following location:
ls -la /var/log/clickhouse-server
Outputs:
drwxrwx--- 1 clickhouse clickhouse 4096 Nov 18 22:31 .
drwxr-xr-x 1 root root 4096 Nov 18 22:28 ..
-rw-r----- 1 clickhouse clickhouse 4611 Nov 18 22:31 clickhouse-server.err.log
-rw-r----- 1 clickhouse clickhouse 275539 Nov 18 22:40 clickhouse-server.log
-rw-r----- 1 clickhouse clickhouse 451 Nov 18 22:31 stderr.log
-rw-r----- 1 clickhouse clickhouse 0 Nov 18 22:31 stdout.log
YOu can see that we have seperate error and standard output logs which we may wish to monitor or search in case of issues.
Changing ClickHouse Log Level
The ClickHouse server logs are often useful in diagnosing issues and understanding how clients are interacting with ClickHouse. They are however fairly low level and detailed out of the box. At this stage therefore, it is worth reducing the logging level to only show warnings and errors as opposed to trace level logging.
To change this, stop the ClickHouse server using CTRL+C, then open the ClickHouse configuration file:
nano /etc/clickhouse-server/config.xml
And change the ClickHouse logger level from trace to warning:
<clickhouse>
<logger>
<level>warning</level>
When you restart the ClickHouse server, you will see fewer logs which are easier to monitor.
Upgrading ClickHouse
Because the data and state is stored in the /var/lib folder, the process of upgrading ClickHouse simply invovles upgrading the service and then restarting.
When the new version starts, the data will be backwards compatible and if necessary, migrated to the new version.