ClickHouse/docs/en/operations/system-tables/trace_log.md

60 lines
3.2 KiB
Markdown
Raw Normal View History

2022-08-28 13:53:52 +00:00
---
---
2022-06-02 10:55:18 +00:00
# trace_log
Contains stack traces collected by the sampling query profiler.
2020-10-13 17:23:29 +00:00
ClickHouse creates this table when the [trace_log](../../operations/server-configuration-parameters/settings.md#server_configuration_parameters-trace_log) server configuration section is set. Also the [query_profiler_real_time_period_ns](../../operations/settings/settings.md#query_profiler_real_time_period_ns) and [query_profiler_cpu_time_period_ns](../../operations/settings/settings.md#query_profiler_cpu_time_period_ns) settings should be set.
2022-01-08 12:21:39 +00:00
To analyze logs, use the `addressToLine`, `addressToLineWithInlines`, `addressToSymbol` and `demangle` introspection functions.
Columns:
- `event_date` ([Date](../../sql-reference/data-types/date.md)) — Date of sampling moment.
- `event_time` ([DateTime](../../sql-reference/data-types/datetime.md)) — Timestamp of the sampling moment.
- `event_time_microseconds` ([DateTime64](../../sql-reference/data-types/datetime64.md)) — Timestamp of the sampling moment with microseconds precision.
- `timestamp_ns` ([UInt64](../../sql-reference/data-types/int-uint.md)) — Timestamp of the sampling moment in nanoseconds.
- `revision` ([UInt32](../../sql-reference/data-types/int-uint.md)) — 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 revision 54429.`. This field contains the `revision`, but not the `version` of a server.
2021-04-04 16:16:35 +00:00
- `trace_type` ([Enum8](../../sql-reference/data-types/enum.md)) — Trace type:
2021-04-04 16:16:35 +00:00
- `Real` represents collecting stack traces by wall-clock time.
- `CPU` represents collecting stack traces by CPU time.
2021-04-04 21:18:48 +00:00
- `Memory` represents collecting allocations and deallocations when memory allocation exceeds the subsequent watermark.
2021-04-04 16:17:42 +00:00
- `MemorySample` represents collecting random allocations and deallocations.
- `thread_number` ([UInt32](../../sql-reference/data-types/int-uint.md)) — Thread identifier.
2020-10-13 17:23:29 +00:00
- `query_id` ([String](../../sql-reference/data-types/string.md)) — Query identifier that can be used to get details about a query that was running from the [query_log](#system_tables-query_log) system table.
- `trace` ([Array(UInt64)](../../sql-reference/data-types/array.md)) — Stack trace at the moment of sampling. Each element is a virtual memory address inside ClickHouse server process.
**Example**
``` sql
SELECT * FROM system.trace_log LIMIT 1 \G
```
``` text
Row 1:
──────
event_date: 2020-09-10
event_time: 2020-09-10 11:23:09
event_time_microseconds: 2020-09-10 11:23:09.872924
timestamp_ns: 1599762189872924510
revision: 54440
trace_type: Memory
thread_id: 564963
2021-07-29 15:27:50 +00:00
query_id:
trace: [371912858,371912789,371798468,371799717,371801313,371790250,624462773,566365041,566440261,566445834,566460071,566459914,566459842,566459580,566459469,566459389,566459341,566455774,371993941,371988245,372158848,372187428,372187309,372187093,372185478,140222123165193,140222122205443]
size: 5244400
```
[Original article](https://clickhouse.com/docs/en/operations/system-tables/trace_log) <!--hide-->