> ## 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_query_* セッション設定

> log_query_* 生成グループに含まれる ClickHouse のセッション設定。

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>デフォルト値</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          再起動せずに変更可能
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

これらの設定は [system.settings](/docs/ja/reference/system-tables/settings) で確認でき、[ソースコード](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) から自動生成されています。

<div id="log_query_settings">
  ## log\_query\_settings
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

クエリ設定をquery\_logとOpenTelemetryのspanログに記録します。

<div id="log_query_threads">
  ## log\_query\_threads
</div>

<SettingsInfoBlock type="Bool" default_value="0" />

クエリスレッドのログ記録を設定します。

クエリスレッドは [system.query\_thread\_log](/docs/ja/reference/system-tables/query_thread_log) テーブルに記録されます。この設定は、[log\_queries](/docs/ja/reference/settings/session-settings/log-queries#log_queries) が true の場合にのみ有効です。この設定を有効にすると、ClickHouse が実行するクエリのスレッドが、サーバー設定パラメータ [query\_thread\_log](/docs/ja/reference/settings/server-settings/settings#query_thread_log) のルールに従って記録されます。

設定可能な値:

* 0 — 無効。
* 1 — 有効。

**例**

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

<div id="log_query_views">
  ## log\_query\_views
</div>

<SettingsInfoBlock type="Bool" default_value="1" />

クエリビューのログ記録を設定します。

この設定を有効にして ClickHouse が実行するクエリに関連するビュー (materialized view または live view) がある場合、それらはサーバー設定パラメータ [query\_views\_log](/docs/ja/reference/settings/server-settings/settings#query_views_log) に記録されます。

例:

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