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

An online analytical processing (OLAP) cluster is created, and the ClickHouse service is selected. For more information, see Create a ClickHouse cluster.

Configure ClickHouse log parameters in the EMR console

Go to the Configure tab on the ClickHouse service page in the EMR console. Click the server-config tab in the Service Configuration section and enter logger. in the search box. Then, you can view or modify all log parameters. logger
ParameterDescription
logger.levelThe 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.sizeThe 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.countThe 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 -h core-1-1 -m
        Note In the sample command, core-1-1 indicates the name of the core node that you log on to. If you have multiple core nodes, you can log on to one of the nodes.
      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 information 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 -h core-1-1 -m --send_logs_level=trace --log-level=trace --server_logs_file='/tmp/query.log'