Determine when HashiCorp Consul snapshot was created.
Inspect snapshot.
$ consul snapshot inspect backup.snapshot
ID 77479-228462-1660165996971 Size 53121 Index 228462 Term 77479 Version 1 Type Count Size ---- ---- ---- KVS 61 37.7KB Register 9 5.6KB ACLToken 7 2.7KB ACLPolicy 4 1.8KB ConnectCA 1 1.2KB ConnectCAProviderState 1 1.2KB Index 21 658B CoordinateBatchUpdate 2 344B SystemMetadata 3 203B Autopilot 1 199B ConnectCAConfig 1 199B FederationState 1 156B ChunkingState 1 12B ---- ---- ---- Total 51.9KB
Use ID field to extract the timestamp.
$ consul snapshot inspect backup.snapshot | awk '$1~"ID" {split($2,time,"-"); printf "%.0f\n", time[3]/(1000)}'
1660165997
Parse timestamp to print the snapshot creation time.
$ date -d @$(consul snapshot inspect backup.snapshot | awk '$1~"ID" {split($2,time,"-"); printf "%.0f\n", time[3]/(1000)}')
Wed Aug 10 09:13:17 PM UTC 2022
Marvelous!