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

116 lines
4.0 KiB
Plaintext
Raw Normal View History

2020-04-07 18:55:19 +00:00
---
layout: commands
2020-04-07 18:55:19 +00:00
page_title: 'Commands: Snapshot Inspect'
sidebar_title: inspect
2020-04-07 18:55:19 +00:00
---
# 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.
2020-04-07 18:55:19 +00:00
## Usage
Usage: `consul snapshot inspect [options] FILE`
## Examples
To inspect a snapshot from the file "backup.snap":
2020-05-19 18:32:38 +00:00
```shell-session
2020-04-07 18:55:19 +00:00
$ consul snapshot inspect backup.snap
2020-11-05 16:31:36 +00:00
ID 2-12426-1604593650375
Size 17228
Index 12426
Term 2
Version 1
2020-11-05 16:31:36 +00:00
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
```
2020-11-05 16:31:36 +00:00
To get more details for a snapshot inspection from "backup.snap":
```shell-session
2020-11-10 17:22:45 +00:00
$ consul snapshot inspect -kvdetails -kvdepth 3 -kvfilter vault/core backup.snap
2020-11-05 16:31:36 +00:00
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
2020-04-07 18:55:19 +00:00
```
2020-04-09 23:46:54 +00:00
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".