Secrets configuration reference

For other top-level configuration options, see:

  • Global Options - Global settings like data directories and timezone
  • Pipeline Components - Configure sources, transforms, sinks, and enrichment tables
  • API - Configure Vector's observability API
  • Schema - Configure Vector's internal schema system

Secrets management lets you keep sensitive configuration values like API keys, passwords, and tokens out of your Vector configuration files.

This is the recommended way to supply secrets to Vector, in preference to environment variable interpolation. Unlike environment variables, secret values are never written to the Vector process’s environment, so they can’t leak to anyone with access to /proc/<PID>/environ or similar.

Usage

Configure one or more backends under the top-level secret option, then reference secrets from those backends anywhere in your configuration using the SECRET[<backend name>.<secret name>] syntax. Vector collects the referenced secret names and queries each required backend when it loads the configuration, including during configuration reloads. It substitutes the retrieved values before parsing the configuration. A secret value containing YAML or TOML syntax can therefore alter the parsed configuration, so only retrieve secrets from backends and paths you trust.

You can reference the same backend from multiple places in your configuration, and you can configure multiple backends if you need to retrieve secrets from more than one source. Backend names support letters, digits, _, and -. Secret names additionally support . and /, allowing hierarchical keys such as SECRET[backend_1.database/password].

If a referenced backend or secret doesn’t exist, a backend reports an error, or a backend returns an empty value, configuration loading fails. Secrets are never partially applied.

Exec backend

The exec backend runs a command that retrieves the referenced secrets. The first item in command is the executable, and any remaining items are passed to it as arguments:

secret:
  external:
    type: "exec"
    command: ["/usr/local/bin/read-secrets", "--environment", "production"]
    timeout: 5

sinks:
  datadog:
    type: "datadog_logs"
    inputs: ["logs"]
    default_api_key: "SECRET[external.datadog_api_key]"

Protocol v1

Vector writes a single JSON request to the command’s standard input. With the default v1 protocol, the request contains the protocol version and all referenced secret names:

{
  "version": "1.0",
  "secrets": ["datadog_api_key"]
}

The order of secrets is unspecified. The command must write a single JSON object to standard output, with one entry for every requested secret:

{
  "datadog_api_key": {
    "value": "example-api-key",
    "error": null
  }
}

For a secret that couldn’t be retrieved, return an error instead of a value:

{
  "datadog_api_key": {
    "value": null,
    "error": "secret not found"
  }
}

Errors, missing entries, empty values, and malformed output cause configuration loading to fail. Standard output must contain only the response JSON. The command can write diagnostic messages to standard error, which Vector logs as warnings.

Protocol v1_1

Protocol v1_1 additionally passes a backend type and its configuration to the command. This supports executables that provide multiple secret storage implementations:

secret:
  external:
    type: "exec"
    command: ["/usr/local/bin/read-secrets"]
    protocol:
      version: "v1_1"
      backend_type: "file.json"
      backend_config:
        file_path: "/etc/vector/secrets.json"

The corresponding request uses protocol version 1.1 and includes the configured type and config values. Its response format is the same as for v1:

{
  "version": "1.1",
  "secrets": ["datadog_api_key"],
  "type": "file.json",
  "config": {
    "file_path": "/etc/vector/secrets.json"
  }
}

File backend

The file backend retrieves secrets from a UTF-8 JSON file:

secret:
  local_file:
    type: "file"
    path: "/etc/vector/secrets.json"

The file must contain a JSON object that maps secret names directly to string values:

{
  "username": "vector",
  "password": "example-password"
}

For example, SECRET[local_file.username] resolves to vector. Unlike the exec response format, file values aren’t wrapped in value and error fields. Every referenced secret must exist and have a non-empty string value.

Directory backend

The directory backend retrieves each secret from a separate UTF-8 file under the configured path:

secret:
  local_directory:
    type: "directory"
    path: "/etc/vector/secrets"
    remove_trailing_whitespace: true

The relative file path is the secret name, so secrets can be organized into nested directories:

/etc/vector/secrets/
├── api_key
└── database/
    ├── username
    └── password

With this layout, SECRET[local_directory.api_key] reads api_key, while SECRET[local_directory.database/username] reads database/username. The complete file contents become the secret value. By default, trailing whitespace, including a final newline, is retained. Set remove_trailing_whitespace to true to remove it.

AWS Secrets Manager backend

For configuration examples, authentication options, and operational guidance, see the AWS Secrets Manager guide and its complete example.

Configuration reference

secret

optional object
All configured secrets backends.

secret.*

required object

Configuration options to retrieve secrets from external backend in order to avoid storing secrets in plaintext in Vector config. Multiple backends can be configured. Use SECRET[<backend_name>.<secret_key>] to tell Vector to retrieve the secret. This placeholder is replaced by the secret retrieved from the relevant backend.

When type is exec, the provided command will be run and provided a list of secrets to fetch, determined from the configuration file, on stdin as JSON in the format:

{"version": "1.0", "secrets": ["secret1", "secret2"]}

The executable is expected to respond with the values of these secrets on stdout, also as JSON, in the format:

{
    "secret1": {"value": "secret_value", "error": null},
    "secret2": {"value": null, "error": "could not fetch the secret"}
}

If an error is returned for any secrets, or if the command exits with a non-zero status code, Vector will log the errors and exit.

Otherwise, the secret must be a JSON text string with key/value pairs. For example:

{
    "username": "test",
    "password": "example-password"
}

If an error occurred while reading the file or retrieving the secrets, Vector logs the error and exits.

Secrets are loaded when Vector starts or if Vector receives a SIGHUP signal triggering its configuration reload process.

secret.*.auth
optional object
Configuration of the authentication strategy for interacting with AWS services.
Relevant when: type = "aws_secrets_manager"
The AWS access key ID.
Examples
"AKIAIOSFODNN7EXAMPLE"
The ARN of an IAM role to assume.
Examples
"arn:aws:iam::123456789098:role/my_role"
Path to the credentials file.
Examples
"/my/aws/credentials"
The optional unique external ID in conjunction with role to assume.
Examples
"randomEXAMPLEidString"
secret.*.auth.imds
optional object
Configuration for authenticating with AWS through IMDS.
Connect timeout for IMDS.
default: 1(seconds)
Number of IMDS retries for fetching tokens and metadata.
default: 4
Read timeout for IMDS.
default: 1(seconds)

Timeout for successfully loading any credentials, in seconds.

Relevant when the default credentials chain or assume_role is used.

Examples
30
secret.*.auth.profile
optional string

The credentials profile to use.

Used to select AWS credentials from a provided credentials file.

Examples
"develop"
default: default
secret.*.auth.region
optional string

The AWS region to send STS requests to.

If not set, this defaults to the configured region for the service itself.

Examples
"us-west-2"
The AWS secret access key.
Examples
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

The optional RoleSessionName is a unique session identifier for your assumed role.

Should be unique per principal or reason. If not set, the session name is autogenerated like assume-role-provider-1736428351340

Examples
"vector-indexer-role"
The AWS session token. See AWS temporary credentials
Examples
"AQoDYXdz...AQoDYXdz..."
secret.*.command
required [string]

Command arguments to execute.

The path to the script or binary must be the first argument.

Relevant when: type = "exec"
secret.*.endpoint
optional string
Custom endpoint for use with AWS-compatible services.
Relevant when: type = "aws_secrets_manager"
Examples
"http://127.0.0.0:5000/path/to/service"
secret.*.path
required string
File path to read secrets from.
Relevant when: type = "file" or type = "directory"
secret.*.protocol
optional object
Settings for the protocol between Vector and the secrets executable.
Relevant when: type = "exec"
The configuration to pass to the secrets executable. This is the config field in the backend request. Refer to the documentation of your backend_type to see which options are required to be set.
Relevant when: version = "v1_1"
The name of the backend. This is type field in the backend request.
Relevant when: version = "v1_1"
secret.*.protocol.version
optional string enum
The protocol version.
Enum options
OptionDescription
v1Expect the command to fetch the configuration options itself.
v1_1Configuration options to the command are to be curried upon each request.
default: v1
secret.*.region
optional string
The AWS region of the target service.
Relevant when: type = "aws_secrets_manager"
Examples
"us-east-1"
Remove trailing whitespace from file contents.
Relevant when: type = "directory"
default: false
secret.*.secret_id
required string
ID of the secret to resolve.
Relevant when: type = "aws_secrets_manager"
secret.*.timeout
optional uint
The timeout, in seconds, to wait for the command to complete.
Relevant when: type = "exec"
default: 5
secret.*.tls
optional object
TLS configuration.
Relevant when: type = "aws_secrets_manager"

Sets the list of supported ALPN protocols.

Declare the supported ALPN protocols, which are used during negotiation with a peer. They are prioritized in the order that they are defined.

Examples
[
  "h2"
]
secret.*.tls.ca_file
optional string

Absolute path to an additional CA certificate file.

The certificate must be in the DER or PEM (X.509) format. Additionally, the certificate can be provided as an inline string in PEM format.

Examples
"/path/to/certificate_authority.crt"
secret.*.tls.crt_file
optional string

Absolute path to a certificate file used to identify this server.

The certificate must be in DER, PEM (X.509), or PKCS#12 format. Additionally, the certificate can be provided as an inline string in PEM format.

If this is set and is not a PKCS#12 archive, key_file must also be set.

Examples
"/path/to/host_certificate.crt"
secret.*.tls.key_file
optional string

Absolute path to a private key file used to identify this server.

The key must be in DER or PEM (PKCS#8) format. Additionally, the key can be provided as an inline string in PEM format.

Examples
"/path/to/host_certificate.key"
secret.*.tls.key_pass
optional string

Passphrase used to unlock the encrypted key file.

This has no effect unless key_file is set.

Examples
"${KEY_PASS_ENV_VAR}"
"PassWord1"

Server name to use when using Server Name Indication (SNI).

Only relevant for outgoing connections.

Examples
"www.example.com"

Enables certificate verification. For components that create a server, this requires that the client connections have a valid client certificate. For components that initiate requests, this validates that the upstream has a valid certificate.

If enabled, certificates must not be expired and must be issued by a trusted issuer. This verification operates in a hierarchical manner, checking that the leaf certificate (the certificate presented by the client/server) is not only valid, but that the issuer of that certificate is also valid, and so on, until the verification process reaches a root certificate.

Do NOT set this to false unless you understand the risks of not verifying the validity of certificates.

Enables hostname verification.

If enabled, the hostname used to connect to the remote host must be present in the TLS certificate presented by the remote host, either as the Common Name or as an entry in the Subject Alternative Name extension.

Only relevant for outgoing connections.

Do NOT set this to false unless you understand the risks of not verifying the remote hostname.

secret.*.type
required string enum
secret type
Enum options
OptionDescription
aws_secrets_managerAWS Secrets Manager.
directoryDirectory.
execExec.
fileFile.