You can view or configure log parameters for the ClickHouse service of your cluster in the E-MapReduce (EMR) console or on the ClickHouse client. This topic describes how to configure log parameters for the ClickHouse service of a cluster.

Prerequisites

A ClickHouse cluster is created. For more information, see Create a cluster.

Configure ClickHouse log parameters in the EMR console

Go to the ClickHouse service page of the EMR console and click the Configure tab. In the Service Configuration section, click the server-config tab and view or modify the log parameters. Alternatively, in the Configuration Filter section of the Configure tab on the ClickHouse service page, enter logger. in the Search field and click the search icon to view or modify all log parameters that appear. Logger
Parameter Description
logger.level The level of the log. The default level is information. The following log levels are sorted based on the urgency degree:
  • none: logging disabled
  • fatal: fatal information
  • critical: critical information
  • error: error information
  • warning: warning information
  • notice: common but important information
  • information: important information or information that you want to take note of. This is the default value.
  • debug: debugging information
  • trace: trace information about program execution paths
logger.path The path that is used by the ClickHouse server to store common logs. The default path is /var/log/clickhouse-server/clickhouse-server.log. The log file records logs of the level specified by the logger.level parameter.
logger.errorlog The path that is used by the ClickHouse server to store error logs. The default path is /var/log/clickhouse-server/clickhouse-server.err.log.
logger.size The maximum size of a log file. If the size of a log file reaches the value of this parameter, ClickHouse archives and renames the log file and creates another log file. The default value is 1000M.
logger.count The maximum number of archived ClickHouse log files. If the number of archived log files reaches the value of this parameter, ClickHouse deletes the earliest archived log files. The default value is 10.

Configure ClickHouse log parameters on the ClickHouse client

You can configure log parameters on the ClickHouse client to receive logs from the ClickHouse server. By default, logs of the fatal level are received.

  1. Log on to the ClickHouse cluster in SSH mode. For more information, see Log on to a cluster.
  2. Perform the following basic operations:
    • View the logs of each execution.
      1. Run the following command to start the ClickHouse client:
        clickhouse-client -m
      2. Run the following command to set the send_logs_level parameter to view the logs of each execution:
        set send_logs_level='debug';
        The following output is returned:
        SET send_logs_level = 'debug'
        Ok.
        0 rows in set. Elapsed: 0.002 sec.
    • Run the following command to save the logs to a specific file when you start the ClickHouse client:
      clickhouse-client -m --send_logs_level=trace --log-level=trace --server_logs_file='/tmp/query.log'