Server Settings

To print log messages only in the console:

```
<logger>
    <level>information</level>
    <console>true</console>
</logger>
```

**Per-level Overrides**

The log level of individual log names can be overridden. For example, to mute all messages of loggers "Backup" and "RBAC".

```
<logger>
    <levels>
        <logger>
            <name>Backup</name>
            <level>none</level>
        </logger>
        <logger>
            <name>RBAC</name>
            <level>none</level>
        </logger>
    </levels>
</logger>
```

**syslog**

To write log messages additionally to syslog:

```
<logger>
    <use_syslog>1</use_syslog>
    <syslog>
        <address>syslog.remote:10514</address>
        <hostname>myhost.local</hostname>
        <facility>LOG_LOCAL6</facility>
        <format>syslog</format>
    </syslog>
</logger>
```

Keys for `<syslog>`:

|  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Key Description|  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | | `address` The address of syslog in format `host\[:port\]`. If omitted, the local daemon is used.| `hostname` The name of the host from which logs are send (optional).|  |  |  |  | | --- | --- | --- | --- | | `facility` The syslog [facility keyword](https://en.wikipedia.org/wiki/Syslog#Facility). Must be specified uppercase with a "LOG\_" prefix, e.g. `LOG_USER`, `LOG_DAEMON`, `LOG_LOCAL3`, etc. Default: `LOG_USER` if `address` is specified, `LOG_DAEMON` otherwise.| `format` Log message format. Possible values: `bsd` and `syslog.` | | | | | | | | | |

**Log formats**

You can specify the log format that will be outputted in the console log. Currently, only JSON is supported.

**Example**

Here is an example of an output JSON log:

```
{
  "date_time_utc": "2024-11-06T09:06:09Z",
  "date_time": "1650918987.180175",
  "thread_name": "#1",
  "thread_id": "254545",
  "level": "Trace",
  "query_id": "",
  "logger_name": "BaseDaemon",
  "message": "Received signal 2",
  "source_file": "../base/daemon/BaseDaemon.cpp; virtual void SignalListener::run()",
  "source_line": "192"
}
```

To enable JSON logging support, use the following snippet:

```
<logger>
    <formatting>
        <type>json</type>
        <!-- Can be configured on a per-channel basis (log, errorlog, console, syslog), or globally for all channels (then just omit it). -->
        <!-- <channel></channel> -->
        <names>
            <date_time>date_time</date_time>
            <thread_name>thread_name</thread_name>
            <thread_id>thread_id</thread_id>
            <level>level</level>
            <query_id>query_id</query_id>
            <logger_name>logger_name</logger_name>
            <message>message</message>
            <source_file>source_file</source_file>
            <source_line>source_line</source_line>
        </names>
    </formatting>
</logger>
```

**Renaming keys for JSON logs**

Key names can be modified by changing tag values inside the `<names>` tag. For example, to change `DATE_TIME` to `MY_DATE_TIME`, you can use `<date_time>MY_DATE_TIME</date_time>`.

**Omitting keys for JSON logs**

Log properties can be omitted by commenting out the property. For example, if you do not want your log to print `query_id`, you can comment out the `<query_id>` tag.

## logger.async[​](#logger.async "Direct link to logger.async")

When `<true>` (default) logging will happen asynchronously (one background thread per output channel). Otherwise it will log inside the thread calling LOG.

## logger.async\_queye\_max\_size[​](#logger.async_queye_max_size "Direct link to logger.async_queye_max_size")

When using async logging, the max amount of messages that will be kept in the the queue waiting for flushing. Extra messages will be dropped.

## logger.console[​](#logger.console "Direct link to logger.console")

Enable logging to the console. Set to `<1>` or `<true>` to enable. Default is `<1>` if ClickHouse does not run in daemon mode, `<0>` otherwise.

## logger.console\_log\_level[​](#logger.console_log_level "Direct link to logger.console_log_level")

Log level for console output. Defaults to `<level>`.

## logger.count[​](#logger.count "Direct link to logger.count")

Rotation policy: How many historical log files ClickHouse are kept at most.

## logger.errorlog[​](#logger.errorlog "Direct link to logger.errorlog")

The path to the error log file.

## logger.formatting.type[​](#logger.formatting.type "Direct link to logger.formatting.type")

Log format for console output. Currently, only `<json>` is supported.

## logger.level[​](#logger.level "Direct link to logger.level")

Log level. Acceptable values: `<none>` (turn logging off), `<fatal>`, `<critical>`, `<error>`, `<warning>`, `<notice>`, `<information>`, `<debug>`, `<trace>`, `<test>`.

## logger.log[​](#logger.log "Direct link to logger.log")

The path to the log file.

## logger.rotation[​](#logger.rotation "Direct link to logger.rotation")

Rotation policy: Controls when log files are rotated. Rotation can be based on size, time, or a combination of both. Examples: 100M, daily, 100M,daily. Once the log file exceeds the specified size or when the specified time interval is reached, it is renamed and archived, and a new log file is created.

## logger.shutdown\_level[​](#logger.shutdown_level "Direct link to logger.shutdown_level")

Shutdown level is used to set the root logger level at server Shutdown.

## logger.size[​](#logger.size "Direct link to logger.size")

Rotation policy: Maximum size of the log files in bytes. Once the log file size exceeds this threshold, it is renamed and archived, and a new log file is created.

## logger.startup\_level[​](#logger.startup_level "Direct link to logger.startup_level")

Startup level is used to set the root logger level at server startup. After startup log level is reverted to the `<level>` setting.

## logger.stream\_compress[​](#logger.stream_compress "Direct link to logger.stream_compress")

Compress log messages using LZ4. Set to `<1>` or `<true>` to enable.

## logger.syslog\_level[​](#logger.syslog_level "Direct link to logger.syslog_level")

Log level for logging to syslog.

## logger.use\_syslog[​](#logger.use_syslog "Direct link to logger.use_syslog")

Also forward log output to syslog.

## macros[​](#macros "Direct link to macros")

Parameter substitutions for replicated tables.

Can be omitted if replicated tables are not used.

For more information, see the section [Creating replicated tables](/docs/engines/table-engines/mergetree-family/replication#creating-replicated-tables).

**Example**

```
<macros incl="macros" optional="true" />
```

## mark\_cache\_policy[​](#mark_cache_policy "Direct link to mark_cache_policy")

Mark cache policy name.

## mark\_cache\_prewarm\_ratio[​](#mark_cache_prewarm_ratio "Direct link to mark_cache_prewarm_ratio")

The ratio of total size of mark cache to fill during prewarm.

## mark\_cache\_size[​](#mark_cache_size "Direct link to mark_cache_size")

Maximum size of cache for marks (index of [`MergeTree`](/docs/engines/table-engines/mergetree-family) family of tables).

Note

This setting can be modified at runtime and will take effect immediately.

## mark\_cache\_size\_ratio[​](#mark_cache_size_ratio "Direct link to mark_cache_size_ratio")

The size of the protected queue (in case of SLRU policy) in the mark cache relative to the cache's total size.

## max\_active\_parts\_loading\_thread\_pool\_size[​](#max_active_parts_loading_thread_pool_size "Direct link to max_active_parts_loading_thread_pool_size")

The number of threads to load active set of data parts (Active ones) at startup.

## max\_authentication\_methods\_per\_user[​](#max_authentication_methods_per_user "Direct link to max_authentication_methods_per_user")

The maximum number of authentication methods a user can be created with or altered to.
Changing this setting does not affect existing users. Create/alter authentication-related queries will fail if they exceed the limit specified in this setting.
Non authentication create/alter queries will succeed.

Note

A value of `0` means unlimited.