title_wip

[Edit this page](https://github.com/ClickHouse/ClickHouse/tree/master/docs/en/operations/system-tables/trace_log.md)

Querying in ClickHouse Cloud

The data in this system table is held locally on each node in ClickHouse Cloud. Obtaining a complete view of all data, therefore, requires the `clusterAllReplicas` function. See [here](/docs/operations/system-tables/overview#system-tables-in-clickhouse-cloud) for further details.

Contains stack traces collected by the [sampling query profiler](/docs/operations/optimizing-performance/sampling-query-profiler).

ClickHouse creates this table when the [trace\_log](/docs/operations/server-configuration-parameters/settings#trace_log) server configuration section is set. Also see settings: [query\_profiler\_real\_time\_period\_ns](/docs/operations/settings/settings#query_profiler_real_time_period_ns), [query\_profiler\_cpu\_time\_period\_ns](/docs/operations/settings/settings#query_profiler_cpu_time_period_ns), [memory\_profiler\_step](/docs/operations/settings/settings#memory_profiler_step),
[memory\_profiler\_sample\_probability](/docs/operations/settings/settings#memory_profiler_sample_probability), [trace\_profile\_events](/docs/operations/settings/settings#trace_profile_events).

To analyze logs, use the `addressToLine`, `addressToLineWithInlines`, `addressToSymbol` and `demangle` introspection functions.

Columns:

- `hostname` ([LowCardinality(String)](/docs/sql-reference/data-types/string)) — Hostname of the server executing the query.
- `event_date` ([Date](/docs/sql-reference/data-types/date)) — Date of sampling moment.
- `event_time` ([DateTime](/docs/sql-reference/data-types/datetime)) — Timestamp of the sampling moment.
- `event_time_microseconds` ([DateTime64](/docs/sql-reference/data-types/datetime64)) — Timestamp of the sampling moment with microseconds precision.
- `timestamp_ns` ([UInt64](/docs/sql-reference/data-types/int-uint)) — Timestamp of the sampling moment in nanoseconds.
- `revision` ([UInt32](/docs/sql-reference/data-types/int-uint)) — ClickHouse server build revision.

  When connecting to the server by `clickhouse-client`, you see the string similar to `Connected to ClickHouse server version 19.18.1.`. This field contains the `revision`, but not the `version` of a server.
- `trace_type` ([Enum8](/docs/sql-reference/data-types/enum)) — Trace type:

  - `Real` represents collecting stack traces by wall-clock time.
  - `CPU` represents collecting stack traces by CPU time.
  - `Memory` represents collecting allocations and deallocations when memory allocation exceeds the subsequent watermark.
  - `MemorySample` represents collecting random allocations and deallocations.
  - `MemoryPeak` represents collecting updates of peak memory usage.
  - `ProfileEvent` represents collecting of increments of profile events.
  - `JemallocSample` represents collecting of jemalloc samples.
  - `MemoryAllocatedWithoutCheck` represents collection of significant allocations (>16MiB) that is done with ignoring any memory limits (for ClickHouse developers only).
  - `Instrumentation` represents traces collected by the instrumentation performed through XRay.
- `cpu_id` ([UInt64](/docs/sql-reference/data-types/int-uint)) — CPU identifier.
- `thread_id` ([UInt64](/docs/sql-reference/data-types/int-uint)) — Thread identifier.
- `query_id` ([String](/docs/sql-reference/data-types/string)) — Query identifier that can be used to get details about a query that was running from the [query\_log](/docs/operations/system-tables/query_log) system table.
- `trace` ([Array(UInt64)](/docs/sql-reference/data-types/array)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process.
- `size` ([Int64](/docs/sql-reference/data-types/int-uint)) - For trace types `Memory`, `MemorySample` or `MemoryPeak` is the amount of memory allocated, for other trace types is 0.
- `event` ([LowCardinality(String)](/docs/sql-reference/data-types/lowcardinality)) - For trace type `ProfileEvent` is the name of updated profile event, for other trace types is an empty string.
- `increment` ([UInt64](/docs/sql-reference/data-types/int-uint)) - For trace type `ProfileEvent` is the amount of increment of profile event, for other trace types is 0.
- `symbols`, ([Array(LowCardinality(String))](/docs/sql-reference/data-types/array)), If the symbolization is enabled, contains demangled symbol names, corresponding to the `trace`.
- `lines`, ([Array(LowCardinality(String))](/docs/sql-reference/data-types/array)), If the symbolization is enabled, contains strings with file names with line numbers, corresponding to the `trace`.
- `function_id` ([Nullable(Int32)](/docs/sql-reference/data-types/nullable)), For trace type Instrumentation, ID assigned to the function in xray\_instr\_map section of elf-binary.
- `function_name` ([Nullable(String)](/docs/sql-reference/data-types/nullable)), For trace type Instrumentation, name of the instrumented function.
- `handler` ([Nullable(String)](/docs/sql-reference/data-types/nullable)), For trace type Instrumentation, handler of the instrumented function.
- `entry_type` ([Nullable(Enum('Entry' = 0, 'Exit' = 1))](/docs/sql-reference/data-types/nullable)), For trace type Instrumentation, entry type of the trace.
- `duration_nanoseconds` ([Nullable(UInt64)](/docs/sql-reference/data-types/nullable)), For trace type Instrumentation, time the function was running for in nanoseconds.

The symbolization can be enabled or disabled in the `symbolize` under `trace_log` in the server's configuration file.

**Example**

```
SELECT * FROM system.trace_log LIMIT 1 \G
```