system.query_log

- `interface` ([UInt8](/docs/sql-reference/data-types/int-uint)) — Interface that the query was initiated from. Possible values:
  - 1 — TCP.
  - 2 — HTTP.
- `os_user` ([String](/docs/sql-reference/data-types/string)) — Operating system username who runs [clickhouse-client](/docs/interfaces/client).
- `client_hostname` ([String](/docs/sql-reference/data-types/string)) — Hostname of the client machine where the [clickhouse-client](/docs/interfaces/client) or another TCP client is run.
- `client_name` ([String](/docs/sql-reference/data-types/string)) — The [clickhouse-client](/docs/interfaces/client) or another TCP client name.
- `client_revision` ([UInt32](/docs/sql-reference/data-types/int-uint)) — Revision of the [clickhouse-client](/docs/interfaces/client) or another TCP client.
- `client_version_major` ([UInt32](/docs/sql-reference/data-types/int-uint)) — Major version of the [clickhouse-client](/docs/interfaces/client) or another TCP client.
- `client_version_minor` ([UInt32](/docs/sql-reference/data-types/int-uint)) — Minor version of the [clickhouse-client](/docs/interfaces/client) or another TCP client.
- `client_version_patch` ([UInt32](/docs/sql-reference/data-types/int-uint)) — Patch component of the [clickhouse-client](/docs/interfaces/client) or another TCP client version.
- `script_query_number` ([UInt32](/docs/sql-reference/data-types/int-uint)) — The query number in a script with multiple queries for [clickhouse-client](/docs/interfaces/client).
- `script_line_number` ([UInt32](/docs/sql-reference/data-types/int-uint)) — The line number of the query start in a script with multiple queries for [clickhouse-client](/docs/interfaces/client).
- `http_method` (UInt8) — HTTP method that initiated the query. Possible values:
  - 0 — The query was launched from the TCP interface.
  - 1 — `GET` method was used.
  - 2 — `POST` method was used.
- `http_user_agent` ([String](/docs/sql-reference/data-types/string)) — HTTP header `UserAgent` passed in the HTTP query.
- `http_referer` ([String](/docs/sql-reference/data-types/string)) — HTTP header `Referer` passed in the HTTP query (contains an absolute or partial address of the page making the query).
- `forwarded_for` ([String](/docs/sql-reference/data-types/string)) — HTTP header `X-Forwarded-For` passed in the HTTP query.
- `quota_key` ([String](/docs/sql-reference/data-types/string)) — The `quota key` specified in the [quotas](/docs/operations/quotas) setting (see `keyed`).
- `revision` ([UInt32](/docs/sql-reference/data-types/int-uint)) — ClickHouse revision.
- `ProfileEvents` ([Map(String, UInt64)](/docs/sql-reference/data-types/map)) — ProfileEvents that measure different metrics. The description of them could be found in the table [system.events](/docs/operations/system-tables/events)
- `Settings` ([Map(String, String)](/docs/sql-reference/data-types/map)) — Settings that were changed when the client ran the query. To enable logging changes to settings, set the `log_query_settings` parameter to 1.
- `log_comment` ([String](/docs/sql-reference/data-types/string)) — Log comment. It can be set to arbitrary string no longer than [max\_query\_size](/docs/operations/settings/settings#max_query_size). An empty string if it is not defined.
- `thread_ids` ([Array(UInt64)](/docs/sql-reference/data-types/array)) — Thread ids that are participating in query execution. These threads may not have run simultaneously.
- `peak_threads_usage` ([UInt64)](/docs/sql-reference/data-types/int-uint)) — Maximum count of simultaneous threads executing the query.
- `used_aggregate_functions` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `aggregate functions`, which were used during query execution.
- `used_aggregate_function_combinators` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `aggregate functions combinators`, which were used during query execution.
- `used_database_engines` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `database engines`, which were used during query execution.
- `used_data_type_families` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `data type families`, which were used during query execution.
- `used_dictionaries` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `dictionaries`, which were used during query execution. For dictionaries configured using an XML file this is the name of the dictionary, and for dictionaries created by an SQL statement, the canonical name is the fully qualified object name.
- `used_formats` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `formats`, which were used during query execution.
- `used_functions` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `functions`, which were used during query execution.
- `used_storages` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `storages`, which were used during query execution.
- `used_table_functions` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `table functions`, which were used during query execution.
- `used_executable_user_defined_functions` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `executable user defined functions`, which were used during query execution.
- `used_sql_user_defined_functions` ([Array(String)](/docs/sql-reference/data-types/array)) — Canonical names of `sql user defined functions`, which were used during query execution.
- `used_privileges` ([Array(String)](/docs/sql-reference/data-types/array)) - Privileges which were successfully checked during query execution.
- `missing_privileges` ([Array(String)](/docs/sql-reference/data-types/array)) - Privileges that are missing during query execution.
- `query_cache_usage` ([Enum8](/docs/sql-reference/data-types/enum)) — Usage of the [query cache](/docs/operations/query-cache) during query execution. Values:
  - `'Unknown'` = Status unknown.
  - `'None'` = The query result was neither written into nor read from the query cache.
  - `'Write'` = The query result was written into the query cache.
  - `'Read'` = The query result was read from the query cache.