AWS Cloudwatch Metrics Sink

The Vector aws_cloudwatch_metrics sink sends metrics to AWS Cloudwatch metrics.

Warnings

Configuration

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

    auth

    Options for the authentication strategy.

    • optionalstring

      access_key_id

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

      • Syntax: literal
    • optionalstring

      assume_role

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

      • Syntax: literal
    • optionalstring

      secret_access_key

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

      • Syntax: literal
  • 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.

    Some cloud storage API clients and browsers will handle decompression transparently, so files may not always appear to be compressed depending how they are accessed.

    • Syntax: literal
    • Default: "none"
    • Enum, must be one of: "none" "gzip" "syntax"
  • commonrequiredstring

    default_namespace

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

    • Syntax: literal
  • optionalstring

    endpoint

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

    • Syntax: literal
    • Only relevant when: region = null
  • commonoptionaltable

    healthcheck

    Health check options for the sink. See Health checks for more info.

    • commonoptionalbool

      enabled

      Enables/disables the healthcheck upon Vector boot.

      • Default: true
  • 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.

    • Syntax: literal
    • Only required when: endpoint = null

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.

    • Syntax: literal
  • commonoptionalstring

    AWS_CONFIG_FILE

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

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

    AWS_CREDENTIAL_EXPIRATION

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

    • Syntax: literal
  • commonoptionalstring

    AWS_DEFAULT_REGION

    The default AWS region.

    • Syntax: literal
    • Only relevant when: endpoint = null
  • 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.

    • Syntax: literal
    • Default: "default"
  • 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.

    • Syntax: literal
  • 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.

    • Syntax: literal
  • commonoptionalstring

    AWS_SESSION_TOKEN

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

    • Syntax: literal
  • commonoptionalstring

    AWS_SHARED_CREDENTIALS_FILE

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

    • Syntax: literal
    • 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

    events_in_total

    The number of events accepted by this component either from tagged origin like file and uri, or cumulatively from other origins. This metric includes the following tags:

    • component_kind - The Vector component kind.

    • component_name - The Vector component ID.

    • component_type - The Vector component type.

    • container_name - The name of the container from which the event originates.

    • file - The file from which the event originates.

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

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

    • mode - The connection mode used by the component.

    • peer_addr - The IP from which the event originates.

    • peer_path - The pathname from which the event originates.

    • pod_name - The name of the pod from which the event originates.

    • uri - The sanitized uri from which the event originates.

  • counter

    events_out_total

    The total number of events emitted 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.

    • 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. Options access_key_id and secret_access_key.
  2. Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  3. The credential_process command in the AWS config file. (usually located at ~/.aws/config)
  4. The AWS credentials file. (usually located at ~/.aws/credentials)
  5. 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. Such created AWS access keys can be used via access_key_id and secret_access_key options.

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.

State

This component is stateless, meaning its behavior is consistent across each input.