cbcat
- reference
- Couchbase Server 8.0
The cbcat tool decrypts and displays the contents of encrypted logs and archive files.
Syntax
The basic syntax is:
cbcat [options] file(s)
where file(s) is a file or multiple files to decrypt and view.
You can use any method supported by the shell to specify multiple files, including wildcards.
Description
When encryption at rest is active, Couchbase Server encrypts sensitive data stored on disk.
This includes logs, configuration files, audit files, and other files generated by Couchbase Server and the services running in the cluster.
The cbcat tool enables you to decrypt and view the contents of these encrypted files.
Depending upon your platform, this tool is at the following locations:
| Operating system | Location |
|---|---|
Linux |
|
Windows |
|
Mac OS X |
|
Options
- --with-dump-keys <filename>
-
The name and location of the
dump-keysbinary. This binary connects to the keystore and gets the encryption keys. If not specified, the default is/opt/couchbase/bin/dump-keys.You do not usually need to use this option if you installed Couchbase Server in the default location.
- --with-gosecrets <filename>
-
The name and location of the
gosecrets.cfgconfiguration file. This file contains information about the location of encryption keys, and other encryption-at-rest settings. If not specified, the default is/opt/couchbase/var/lib/couchbase/config/gosecrets.cfg.You do not usually need to use this option if you installed Couchbase Server in the default location.
- --password <password>
-
The master password to use for decryption. Use
-to prompt for a password or to read from standard input.This option and the
--with-keystoreoption are mutually exclusive. You can only use one of these options. - --with-keystore <json>
-
A JSON representation of a keystore containing the keys that were used to encrypt the files you want to decrypt and view. Use
-to read from standard input.This option and the
--passwordoption are mutually exclusive. You can only use one of these options. - --print-header
-
Prints a header with the file name before the content of the file.
- --dump-encryption-header
-
Prints information from the encryption header, if the file is encrypted.
- --version
-
Displays the program version.
- --help
-
Displays help text.
Schema
The --with-keystore option expects a JSON value with the following schema.
| One of … | Schema | |
|---|---|---|
An object which contains a key definition. |
||
or |
An array of objects, each of which contains a key definition. |
Key Definition array |
Key Definition
| Property | Schema | |
|---|---|---|
cipher |
The encryption algorithm used for the data encryption key. Currently, only one encryption algorithm is supported. Value: |
String |
id |
The ID of the data encryption key that was used to encrypt the file you want to view. This is not the same as the user-friendly name that you can specify when you create a key, or the integer that the Encryption-at-Rest API assigns to a key. |
String (UUID) |
key |
The value of the data encryption key that was used to encrypt the file you want to view. |
String |
To decrypt and view a single file, the keystore only needs to contain a single key definition, which must be the key used to encrypt that file. To decrypt and view multiple files, the keystore must contain the definitions of the keys that were used to encrypt each file.
To get the ID of the key that was used to encrypt a file, you can use cbcat with the --dump-encryption-header option.
See Example 5.
Alternatively, if the keystore contains at least one valid key definition, but does not contain the correct key for the file you want to decrypt, cbcat tells you the ID of the key that’s required.
To get the value of a key given its ID, use the dump-keys binary.
See Example 6.
Output
The tool outputs the contents of the specified input files. If any input files were encrypted, the output is decrypted.
Examples
In the following examples, $MASTER is the master password used to encrypt the logs and configuration files.
cbcat --password $MASTER eventing.log
cbcat --password - eventing.log
Password:
cbcat --password $MASTER eventing.log ns_couchdb.log
The following command decrypts and views all files whose names begin with memcached.
cbcat --password $MASTER --print-header memcached*
File: memcached.json ====================================================================== <file content ...> File: memcached.rbac ====================================================================== <file content ...>
cbcat --password $MASTER --dump-encryption-header memcached.rbac
File: memcached.rbac
Encrypted:
Key ID: 3f64f34c-a0bd-4248-a1da-5769e5bc15ef
Key Derivation: KeyBased
Compression: None
======================================================================
<file content ...>
The following command finds the value of a data encryption key, using the key ID returned by Example 5.
dump-keys -p $MASTER -k 3f64f34c-a0bd-4248-a1da-5769e5bc15ef
{
"3f64f34c-a0bd-4248-a1da-5769e5bc15ef": {
"result": "raw-aes-gcm",
"response": {
"kind": "configDek",
"name": "3f64f34c-a0bd-4248-a1da-5769e5bc15ef",
"key": "5YHAbvomWQuMZSnwQcSWhh4c+XpiildvYlOpbg7VLLE=",
"encryptionKeyId": "encryptionService",
"creationTime": "2026-06-30T11:32:03Z",
"imported": false
}
}
}
The following command uses a JSON keystore to decrypt and view a file.
In the JSON keystore, the id property is the key ID, and the key property is the same as the key property returned by the previous command.
cbcat --with-keystore '{
"cipher": "AES-256-GCM",
"id": "3f64f34c-a0bd-4248-a1da-5769e5bc15ef",
"key": "5YHAbvomWQuMZSnwQcSWhh4c+XpiildvYlOpbg7VLLE="
}' memcached.rbac