> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# log_queries_* session settings

> ClickHouse session settings in the log_queries_* generated group.

These settings are available in [system.settings](https://clickhouse.com/docs/reference/system-tables/settings.md) and are autogenerated from [source](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp).

## log\_queries

Type

Bool

Default

1

Setting up query logging.

Queries sent to ClickHouse with this setup are logged according to the rules in the [query\_log](https://clickhouse.com/docs/reference/settings/server-settings/settings/query.md#query_log) server configuration parameter.

Example:

```text theme={null}
log_queries=1
```

## log\_queries\_cut\_to\_length

Type

UInt64

Default

100000

If query length is greater than a specified threshold (in bytes), then cut query when writing to query log. Also limit the length of printed query in ordinary text log.

## log\_queries\_min\_query\_duration\_ms

Type

Milliseconds

Default

0

If enabled (non-zero), queries faster than the value of this setting will not be logged (you can think about this as a `long_query_time` for [MySQL Slow Query Log](https://dev.mysql.com/doc/refman/5.7/slow-query-log.html)), and this basically means that you will not find them in the following tables:

* `system.query_log`
* `system.query_thread_log`

Only the queries with the following type will get to the log:

* `QUERY_FINISH`

* `EXCEPTION_WHILE_PROCESSING`

* Type: milliseconds

* Default value: 0 (any query)

## log\_queries\_min\_type

Type

LogQueriesType

Default

QUERY\_START

`query_log` minimal type to log.

Possible values:

* `QUERY_START` (`=1`)
* `QUERY_FINISH` (`=2`)
* `EXCEPTION_BEFORE_START` (`=3`)
* `EXCEPTION_WHILE_PROCESSING` (`=4`)

Can be used to limit which entities will go to `query_log`, say you are interested only in errors, then you can use `EXCEPTION_WHILE_PROCESSING`:

```text theme={null}
log_queries_min_type='EXCEPTION_WHILE_PROCESSING'
```

## log\_queries\_probability

Type

Float

Default

1

Allows a user to write to [query\_log](https://clickhouse.com/docs/reference/system-tables/query_log.md), [query\_thread\_log](https://clickhouse.com/docs/reference/system-tables/query_thread_log.md), and [query\_views\_log](https://clickhouse.com/docs/reference/system-tables/query_views_log.md) system tables only a sample of queries selected randomly with the specified probability. It helps to reduce the load with a large volume of queries in a second.

Possible values:

* 0 — Queries are not logged in the system tables.
* Positive floating-point number in the range \[0..1]. For example, if the setting value is `0.5`, about half of the queries are logged in the system tables.
* 1 — All queries are logged in the system tables.
