AWS Cloudwatch Metrics Sink

The Vector aws_cloudwatch_metrics sink sends metrics to AWS Cloudwatch metrics.

Configuration

[sinks.my_sink_id]
type = "aws_cloudwatch_metrics" # required
inputs = ["my-source-or-transform-id"] # required
compression = "none" # optional, default
default_namespace = "service" # required
healthcheck = true # optional, default
region = "us-east-1" # required, required when endpoint = null
  • optionalstring

    assume_role

    The ARN of an IAM role to assume at startup. See AWS Authentication for more info.

    • View examples
  • optionaltable

    batch

    Configures the sink batching behavior.

    • commonoptionaluint

      max_events

      The maximum size of a batch, in events, before it is flushed.

      • Default: 20 (events)
    • commonoptionaluint

      timeout_secs

      The maximum age of a batch before it is flushed.

      • Default: 1 (seconds)
  • enumcommonoptionalstring

    compression

    The compression strategy used to compress the encoded event data before transmission.

    • Default: "none"
    • Enum, must be one of: "none" "gzip"
    • View examples
  • commonrequiredstring

    default_namespace

    A namespace that will isolate different metrics from each other. Used as a namespace for metrics that don't have it.

    • View examples
  • optionalstring

    endpoint

    Custom endpoint for use with AWS-compatible services. Providing a value for this option will make region moot.

    • Only relevant when: region = null
    • View examples
  • commonoptionalbool

    healthcheck

    Enables/disables the sink healthcheck upon Vector boot. See Health checks for more info.

    • Default: true
    • View examples
  • commonrequired*string

    region

    The AWS region of the target service. If endpoint is provided it will override this value since the endpoint includes the region.

    • Only required when: endpoint = null
    • View examples

Env Vars

  • commonoptionalstring

    AWS_ACCESS_KEY_ID

    The AWS access key id. Used for AWS authentication when communicating with AWS services. See AWS Authentication for more info.

    • View examples
  • commonoptionalstring

    AWS_CONFIG_FILE

    Specifies the location of the file that the AWS CLI uses to store configuration profiles.

    • Default: "~/.aws/config"
  • commonoptionalstring

    AWS_CREDENTIAL_EXPIRATION

    Expiration time in RFC 3339 format. If unset, credentials won't expire.

    • View examples
  • commonoptionalstring

    AWS_DEFAULT_REGION

    The default AWS region.

    • Only relevant when: endpoint = null
    • View examples
  • commonoptionalstring

    AWS_PROFILE

    Specifies the name of the CLI profile with the credentials and options to use. This can be the name of a profile stored in a credentials or config file.

    • Default: "default"
    • View examples
  • commonoptionalstring

    AWS_ROLE_SESSION_NAME

    Specifies a name to associate with the role session. This value appears in CloudTrail logs for commands performed by the user of this profile.

    • View examples
  • commonoptionalstring

    AWS_SECRET_ACCESS_KEY

    The AWS secret access key. Used for AWS authentication when communicating with AWS services. See AWS Authentication for more info.

    • View examples
  • commonoptionalstring

    AWS_SESSION_TOKEN

    The AWS session token. Used for AWS authentication when communicating with AWS services.

    • View examples
  • commonoptionalstring

    AWS_SHARED_CREDENTIALS_FILE

    Specifies the location of the file that the AWS CLI uses to store access keys.

    • Default: "~/.aws/credentials"

Telemetry

This component provides the following metrics that can be retrieved through the internal_metrics source. See the metrics section in the monitoring page for more info.

  • counter

    processed_events_total

    The total number of events processed by this component. This metric includes the following tags:

    • component_kind - The Vector component kind.

    • component_name - The Vector component ID.

    • component_type - The Vector component type.

    • file - The file that produced the error

    • instance - The Vector instance identified by host and port.

    • job - The name of the job producing Vector metrics.

  • counter

    processed_bytes_total

    The total number of bytes processed by the component. This metric includes the following tags:

    • component_kind - The Vector component kind.

    • component_name - The Vector component ID.

    • component_type - The Vector component type.

    • instance - The Vector instance identified by host and port.

    • job - The name of the job producing Vector metrics.

How It Works

AWS Authentication

Vector checks for AWS credentials in the following order:

  1. Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  2. The credential_process command in the AWS config file. (usually located at ~/.aws/config)
  3. The AWS credentials file. (usually located at ~/.aws/credentials)
  4. The IAM instance profile. (will only work if running on an EC2 instance with an instance profile/role)

If credentials are not found the healtcheck will fail and an error will be logged.

Obtaining an access key

In general, we recommend using instance profiles/roles whenever possible. In cases where this is not possible you can generate an AWS access key for any user within your AWS account. AWS provides a detailed guide on how to do this.

Assuming roles

Vector can assume an AWS IAM role via the assume_role option. This is an optional setting that is helpful for a variety of use cases, such as cross account access.

Health checks

Health checks ensure that the downstream service is accessible and ready to accept data. This check is performed upon sink initialization. If the health check fails an error will be logged and Vector will proceed to start.

Require health checks

If you'd like to exit immediately upon a health check failure, you can pass the --require-healthy flag:

vector --config /etc/vector/vector.toml --require-healthy

Disable health checks

If you'd like to disable health checks for this sink you can set the healthcheck option to false.