|
| 1 | +--- |
| 2 | +description: 'System table containing information about metadata files read from Iceberg tables. Each entry |
| 3 | + represents either a root metadata file, metadata extracted from an Avro file, or an entry of some Avro file.' |
| 4 | +keywords: ['system table', 'iceberg_metadata_log'] |
| 5 | +slug: /operations/system-tables/iceberg_metadata_log |
| 6 | +title: 'system.iceberg_metadata_log' |
| 7 | +--- |
| 8 | + |
| 9 | +import SystemTableCloud from '@site/docs/_snippets/_system_table_cloud.md'; |
| 10 | + |
| 11 | +# system.iceberg_metadata_log |
| 12 | + |
| 13 | +The `system.iceberg_metadata_log` table records metadata access and parsing events for Iceberg tables read by ClickHouse. It provides detailed information about each metadata file or entry processed, which is useful for debugging, auditing, and understanding Iceberg table structure evolution. |
| 14 | + |
| 15 | +## Purpose {#purpose} |
| 16 | + |
| 17 | +This table logs every metadata file and entry read from Iceberg tables, including root metadata files, manifest lists, and manifest entries. It helps users trace how ClickHouse interprets Iceberg table metadata and diagnose issues related to schema evolution, file resolution, or query planning. |
| 18 | + |
| 19 | +:::note |
| 20 | +This table is primarily intended for debugging purposes. |
| 21 | +:::note |
| 22 | + |
| 23 | +## Columns {#columns} |
| 24 | +| Name | Type | Description | |
| 25 | +|----------------|-----------|----------------------------------------------------------------------------------------------| |
| 26 | +| `event_date` | [Date](../../sql-reference/data-types/date.md) | Date of the log entry. | |
| 27 | +| `event_time` | [DateTime](../../sql-reference/data-types/datetime.md) | Timestamp of the event. | |
| 28 | +| `query_id` | [String](../../sql-reference/data-types/string.md) | Query ID that triggered the metadata read. | |
| 29 | +| `content_type` | [Enum8](../../sql-reference/data-types/enum.md) | Type of metadata content (see below). | |
| 30 | +| `table_path` | [String](../../sql-reference/data-types/string.md) | Path to the Iceberg table. | |
| 31 | +| `file_path` | [String](../../sql-reference/data-types/string.md) | Path to the root metadata JSON file, Avro manifest list, or manifest file. | |
| 32 | +| `content` | [String](../../sql-reference/data-types/string.md) | Content in JSON format (raw metadata from .json, Avro metadata, or Avro entry). | |
| 33 | +| `row_in_file` | [Nullable](../../sql-reference/data-types/nullable.md)([UInt64](../../sql-reference/data-types/int-uint.md)) | Row number in the file, if applicable. Present for `ManifestListEntry` and `ManifestFileEntry` content types. | |
| 34 | + |
| 35 | +## `content_type` values {#content-type-values} |
| 36 | + |
| 37 | +- `None`: No content. |
| 38 | +- `Metadata`: Root metadata file. |
| 39 | +- `ManifestListMetadata`: Manifest list metadata. |
| 40 | +- `ManifestListEntry`: Entry in a manifest list. |
| 41 | +- `ManifestFileMetadata`: Manifest file metadata. |
| 42 | +- `ManifestFileEntry`: Entry in a manifest file. |
| 43 | + |
| 44 | +<SystemTableCloud/> |
| 45 | + |
| 46 | +## Controlling log verbosity {#controlling-log-verbosity} |
| 47 | + |
| 48 | +You can control which metadata events are logged using the [`iceberg_metadata_log_level`](../../operations/settings/settings.md#iceberg_metadata_log_level) setting. |
| 49 | + |
| 50 | +To log all metadata used in the current query: |
| 51 | + |
| 52 | +```sql |
| 53 | +SELECT * FROM my_iceberg_table SETTINGS iceberg_metadata_log_level = 'manifest_file_entry'; |
| 54 | + |
| 55 | +SYSTEM FLUSH LOGS iceberg_metadata_log; |
| 56 | + |
| 57 | +SELECT content_type, file_path, row_in_file |
| 58 | +FROM system.iceberg_metadata_log |
| 59 | +WHERE query_id = '{previous_query_id}'; |
| 60 | +``` |
| 61 | + |
| 62 | +To log only the root metadata JSON file used in the current query: |
| 63 | + |
| 64 | +```sql |
| 65 | +SELECT * FROM my_iceberg_table SETTINGS iceberg_metadata_log_level = 'metadata'; |
| 66 | + |
| 67 | +SYSTEM FLUSH LOGS iceberg_metadata_log; |
| 68 | + |
| 69 | +SELECT content_type, file_path, row_in_file |
| 70 | +FROM system.iceberg_metadata_log |
| 71 | +WHERE query_id = '{previous_query_id}'; |
| 72 | +``` |
| 73 | + |
| 74 | +See more information in the description of the [`iceberg_metadata_log_level`](../../operations/settings/settings.md#iceberg_metadata_log_level) setting. |
| 75 | + |
| 76 | +### Good To Know {#good-to-know} |
| 77 | + |
| 78 | +- Use `iceberg_metadata_log_level` at the query level only when you need to investigate your Iceberg table in detail. Otherwise, you may populate the log table with excessive metadata and experience performance degradation. |
| 79 | +- The table may contain duplicate entries, as it is intended primarily for debugging and does not guarantee uniqueness per entity. |
| 80 | +- If you use a `content_type` more verbose than `ManifestListMetadata`, the Iceberg metadata cache is disabled for manifest lists. |
| 81 | +- Similarly, if you use a `content_type` more verbose than `ManifestFileMetadata`, the Iceberg metadata cache is disabled for manifest files. |
| 82 | + |
| 83 | +## See also {#see-also} |
| 84 | +- [Iceberg Table Engine](../../engines/table-engines/integrations/iceberg.md) |
| 85 | +- [Iceberg Table Function](../../sql-reference/table-functions/iceberg.md) |
| 86 | +- [system.iceberg_history](./iceberg_history.md) |
0 commit comments