> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> System table containing logging entries with information about `BACKUP` and `RESTORE` operations.

# system.backup_log

<Info>
  **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](/reference/system-tables/overview#system-tables-in-clickhouse-cloud) for further details.
</Info>

<h2 id="description">
  Description
</h2>

Contains logging entries with information about `BACKUP` and `RESTORE` operations.

<h2 id="columns">
  Columns
</h2>

* `hostname` ([LowCardinality(String)](/reference/data-types/lowcardinality)) — Hostname of the server executing the query.
* `event_date` ([Date](/reference/data-types/date)) — Date of the entry.
* `event_time` ([DateTime](/reference/data-types/datetime)) — Time of the entry.
* `event_time_microseconds` ([DateTime64(6)](/reference/data-types/datetime64)) — Time of the entry with microseconds precision.
* `id` ([String](/reference/data-types/string)) — Identifier of the backup or restore operation.
* `name` ([String](/reference/data-types/string)) — Name of the backup storage (the contents of the FROM or TO clause).
* `base_backup_name` ([String](/reference/data-types/string)) — The name of base backup in case incremental one.
* `query_id` ([String](/reference/data-types/string)) — The ID of a query associated with a backup operation.
* `status` ([Enum8('CREATING\_BACKUP' = 0, 'BACKUP\_CREATED' = 1, 'BACKUP\_FAILED' = 2, 'RESTORING' = 3, 'RESTORED' = 4, 'RESTORE\_FAILED' = 5, 'BACKUP\_CANCELLED' = 6, 'RESTORE\_CANCELLED' = 7)](/reference/data-types/enum)) — Operation status.
* `error` ([String](/reference/data-types/string)) — Error message of the failed operation (empty string for successful operations).
* `start_time` ([DateTime64(6)](/reference/data-types/datetime64)) — Start time of the operation.
* `end_time` ([DateTime64(6)](/reference/data-types/datetime64)) — End time of the operation.
* `num_files` ([UInt64](/reference/data-types/int-uint)) — Number of files stored in the backup.
* `total_size` ([UInt64](/reference/data-types/int-uint)) — Total size of files stored in the backup.
* `num_entries` ([UInt64](/reference/data-types/int-uint)) — Number of entries in the backup, i.e. the number of files inside the folder if the backup is stored as a folder, or the number of files inside the archive if the backup is stored as an archive. It is not the same as `num_files` if it's an incremental backup or if it contains empty files or duplicates. The following is always true: `num_entries ≤ num_files`.
* `uncompressed_size` ([UInt64](/reference/data-types/int-uint)) — Uncompressed size of the backup.
* `compressed_size` ([UInt64](/reference/data-types/int-uint)) — Compressed size of the backup. If the backup is not stored as an archive it equals to uncompressed\_size.
* `files_read` ([UInt64](/reference/data-types/int-uint)) — Number of files read during the restore operation.
* `bytes_read` ([UInt64](/reference/data-types/int-uint)) — Total size of files read during the restore operation.

<h2 id="example">
  Example
</h2>

```sql theme={null}
BACKUP TABLE test_db.my_table TO Disk('backups_disk', '1.zip')
```

```response theme={null}
┌─id───────────────────────────────────┬─status─────────┐
│ e5b74ecb-f6f1-426a-80be-872f90043885 │ BACKUP_CREATED │
└──────────────────────────────────────┴────────────────┘
```

```sql theme={null}
SELECT * FROM system.backup_log WHERE id = 'e5b74ecb-f6f1-426a-80be-872f90043885' ORDER BY event_date, event_time_microseconds \G
```

```response theme={null}
Row 1:
──────
hostname:                clickhouse.eu-central1.internal
event_date:              2023-08-19
event_time_microseconds: 2023-08-19 11:05:21.998566
id:                      e5b74ecb-f6f1-426a-80be-872f90043885
name:                    Disk('backups_disk', '1.zip')
status:                  CREATING_BACKUP
error:                   
start_time:              2023-08-19 11:05:21
end_time:                1970-01-01 03:00:00
num_files:               0
total_size:              0
num_entries:             0
uncompressed_size:       0
compressed_size:         0
files_read:              0
bytes_read:              0

Row 2:
──────
hostname:                clickhouse.eu-central1.internal
event_date:              2023-08-19
event_time:              2023-08-19 11:08:56
event_time_microseconds: 2023-08-19 11:08:56.916192
id:                      e5b74ecb-f6f1-426a-80be-872f90043885
name:                    Disk('backups_disk', '1.zip')
status:                  BACKUP_CREATED
error:                   
start_time:              2023-08-19 11:05:21
end_time:                2023-08-19 11:08:56
num_files:               57
total_size:              4290364870
num_entries:             46
uncompressed_size:       4290362365
compressed_size:         3525068304
files_read:              0
bytes_read:              0
```

```sql theme={null}
RESTORE TABLE test_db.my_table FROM Disk('backups_disk', '1.zip')
```

```response theme={null}
┌─id───────────────────────────────────┬─status───┐
│ cdf1f731-52ef-42da-bc65-2e1bfcd4ce90 │ RESTORED │
└──────────────────────────────────────┴──────────┘
```

```sql theme={null}
SELECT * FROM system.backup_log WHERE id = 'cdf1f731-52ef-42da-bc65-2e1bfcd4ce90' ORDER BY event_date, event_time_microseconds \G
```

```response theme={null}
Row 1:
──────
hostname:                clickhouse.eu-central1.internal
event_date:              2023-08-19
event_time_microseconds: 2023-08-19 11:09:19.718077
id:                      cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
name:                    Disk('backups_disk', '1.zip')
status:                  RESTORING
error:                   
start_time:              2023-08-19 11:09:19
end_time:                1970-01-01 03:00:00
num_files:               0
total_size:              0
num_entries:             0
uncompressed_size:       0
compressed_size:         0
files_read:              0
bytes_read:              0

Row 2:
──────
hostname:                clickhouse.eu-central1.internal
event_date:              2023-08-19
event_time_microseconds: 2023-08-19 11:09:29.334234
id:                      cdf1f731-52ef-42da-bc65-2e1bfcd4ce90
name:                    Disk('backups_disk', '1.zip')
status:                  RESTORED
error:                   
start_time:              2023-08-19 11:09:19
end_time:                2023-08-19 11:09:29
num_files:               57
total_size:              4290364870
num_entries:             46
uncompressed_size:       4290362365
compressed_size:         4290362365
files_read:              57
bytes_read:              4290364870
```

This is essentially the same information that is written in the system table `system.backups`:

```sql theme={null}
SELECT * FROM system.backups ORDER BY start_time
```

```response theme={null}
┌─id───────────────────────────────────┬─name──────────────────────────┬─status─────────┬─error─┬──────────start_time─┬────────────end_time─┬─num_files─┬─total_size─┬─num_entries─┬─uncompressed_size─┬─compressed_size─┬─files_read─┬─bytes_read─┐
│ e5b74ecb-f6f1-426a-80be-872f90043885 │ Disk('backups_disk', '1.zip') │ BACKUP_CREATED │       │ 2023-08-19 11:05:21 │ 2023-08-19 11:08:56 │        57 │ 4290364870 │          46 │        4290362365 │      3525068304 │          0 │          0 │
│ cdf1f731-52ef-42da-bc65-2e1bfcd4ce90 │ Disk('backups_disk', '1.zip') │ RESTORED       │       │ 2023-08-19 11:09:19 │ 2023-08-19 11:09:29 │        57 │ 4290364870 │          46 │        4290362365 │      4290362365 │         57 │ 4290364870 │
└──────────────────────────────────────┴───────────────────────────────┴────────────────┴───────┴─────────────────────┴─────────────────────┴───────────┴────────────┴─────────────┴───────────────────┴─────────────────┴────────────┴────────────┘
```

<h2 id="see-also">
  See Also
</h2>

* [Backup and Restore](/concepts/features/backup-restore/overview)
