open-consul/website/content/commands/snapshot/inspect.mdx

116 lines
4.0 KiB
Plaintext

---
layout: commands
page_title: 'Commands: Snapshot Inspect'
sidebar_title: inspect
---
# Consul Snapshot Inspect
Command: `consul snapshot inspect`
The `snapshot inspect` command is used to inspect an atomic, point-in-time
snapshot of the state of the Consul servers which includes key/value entries,
service catalog, prepared queries, sessions, and ACLs. The snapshot is read
from the given file.
The following fields are displayed when inspecting a snapshot:
- `ID` - A unique ID for the snapshot, only used for differentiation purposes.
- `Size` - The size of the snapshot, in bytes.
- `Index` - The Raft index of the latest log entry in the snapshot.
- `Term` - The Raft term of the latest log entry in the snapshot.
- `Version` - The snapshot format version. This only refers to the structure of
the snapshot, not the data contained within.
- Each data type, size, and count within the read snapshot.
## Usage
Usage: `consul snapshot inspect [options] FILE`
## Examples
To inspect a snapshot from the file "backup.snap":
```shell-session
$ consul snapshot inspect backup.snap
ID 2-12426-1604593650375
Size 17228
Index 12426
Term 2
Version 1
Type Count Size
---- ---- ----
KVS 27 12.3KB
Register 5 3.4KB
Index 11 285B
Autopilot 1 199B
Session 1 199B
CoordinateBatchUpdate 1 166B
Tombstone 2 146B
FederationState 1 139B
ChunkingState 1 12B
---- ---- ----
Total 16.8KB
```
To get more details for a snapshot inspection from "backup.snap":
```shell-session
$ consul snapshot inspect -kvdetails -kvdepth 3 -kvfilter vault/core backup.snap
ID 2-12426-1604593650375
Size 17228
Index 12426
Term 2
Version 1
Type Count Size
---- ---- ----
KVS 27 12.3KB
Register 5 3.4KB
Index 11 285B
Autopilot 1 199B
Session 1 199B
CoordinateBatchUpdate 1 166B
Tombstone 2 146B
FederationState 1 139B
ChunkingState 1 12B
---- ---- ----
Total 16.8KB
Key Name Count Size
---- ---- ----
vault/core/leader 1 1.6KB
vault/core/mounts 1 675B
vault/core/wrapping 1 633B
vault/core/local-mounts 1 450B
vault/core/auth 1 423B
vault/core/cluster 2 388B
vault/core/keyring 1 320B
vault/core/master 1 237B
vault/core/seal-config 1 211B
vault/core/hsm 1 189B
vault/core/local-audit 1 185B
vault/core/local-auth 1 183B
vault/core/audit 1 179B
vault/core/lock 1 170B
vault/core/shamir-kek 1 159B
---- ---- ----
Total 5.9KB
```
Please see the [HTTP API](/api/snapshot) documentation for
more details about snapshot internals.
#### Command Options
- `-kvdetails` - Optional, provides a space usage breakdown for any KV data stored in Consul.
- `-kvdepth` - Can only be used with `-kvdetails`. Used to adjust the grouping level of keys. Defaults to 2.
- `-kvfilter` - Can only be used with `-kvdetails`. Used to specify a key prefix that excludes keys that don't match.
- `-format` - Optional, allows from changing the output to JSON. Parameters accepted are "pretty" and "JSON".