AWS Cloudwatch metrics

Publish metric events to AWS Cloudwatch Metrics

status: stable delivery: at-least-once egress: batch state: stateless

Warnings

Gauge values are persisted between flushes. On Vector start up each gauge is assumed to have zero, 0.0, value, that can be updated explicitly by the consequent absolute, not delta, gauge observation, or by delta increments/decrements. Delta gauges are considered an advanced feature useful in a distributed setting, however they should be used with care.

Configuration

Example configurations

{
  "sinks": {
    "my_sink_id": {
      "type": "aws_cloudwatch_metrics",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "default_namespace": "service",
      "compression": "none",
      "region": "us-east-1"
    }
  }
}
[sinks.my_sink_id]
type = "aws_cloudwatch_metrics"
inputs = [ "my-source-or-transform-id" ]
default_namespace = "service"
compression = "none"
region = "us-east-1"
---
sinks:
  my_sink_id:
    type: aws_cloudwatch_metrics
    inputs:
      - my-source-or-transform-id
    default_namespace: service
    compression: none
    healthcheck: null
    region: us-east-1
{
  "sinks": {
    "my_sink_id": {
      "type": "aws_cloudwatch_metrics",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "endpoint": "127.0.0.0:5000/path/to/service",
      "default_namespace": "service",
      "compression": "none",
      "region": "us-east-1"
    }
  }
}
[sinks.my_sink_id]
type = "aws_cloudwatch_metrics"
inputs = [ "my-source-or-transform-id" ]
endpoint = "127.0.0.0:5000/path/to/service"
default_namespace = "service"
compression = "none"
region = "us-east-1"
---
sinks:
  my_sink_id:
    type: aws_cloudwatch_metrics
    inputs:
      - my-source-or-transform-id
    auth: null
    endpoint: 127.0.0.0:5000/path/to/service
    default_namespace: service
    batch: null
    compression: none
    healthcheck: null
    proxy: null
    region: us-east-1

auth

optional object
Options for the authentication strategy.

auth.access_key_id

optional string literal
The AWS access key id. Used for AWS authentication when communicating with AWS services.

auth.assume_role

optional string literal
The ARN of an IAM role to assume at startup.

auth.secret_access_key

optional string literal
The AWS secret access key. Used for AWS authentication when communicating with AWS services.

batch

optional object
Configures the sink batching behavior.

batch.max_events

optional uint
The maximum size of a batch, in events, before it is flushed.
default: 20 (events)

batch.timeout_secs

optional uint
The maximum age of a batch before it is flushed.
default: 1 (seconds)

compression

common optional string literal enum

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.

Enum options string literal
OptionDescription
gzipGzip standard DEFLATE compression.
noneNo compression.
syntaxliteral
default: none

default_namespace

required string literal
A namespace that will isolate different metrics from each other. Used as a namespace for metrics that don’t have it.
Examples
"service"

endpoint

optional string literal
Custom endpoint for use with AWS-compatible services. Providing a value for this option will make region moot.
Examples
"127.0.0.0:5000/path/to/service"
Relevant when: region = null

healthcheck

common optional object
Health check options for the sink.

healthcheck.enabled

optional bool
Enables/disables the healthcheck upon Vector boot.
default: true

inputs

required [string]

A list of upstream source or transform IDs. Wildcards (*) are supported.

See configuration for more info.

Array string literal
Examples
[
 "my-source-or-transform-id",
 "prefix-*"
]

proxy

optional object
Configures an HTTP(S) proxy for Vector to use. By default, the globally configured proxy is used.

proxy.enabled

optional bool
If false the proxy will be disabled.
default: true

proxy.http

optional string literal
The URL to proxy HTTP requests through.

proxy.https

optional string literal
The URL to proxy HTTPS requests through.

proxy.no_proxy

optional array

A list of hosts to avoid proxying. Allowed patterns here include:

PatternExample match
Domain namesexample.com matches requests to example.com
Wildcard domains.example.com matches requests to example.com and its subdomains
IP addresses127.0.0.1 matches requests to 127.0.0.1
CIDR blocks192.168.0.0./16 matches requests to any IP addresses in this range
Splat* matches all hosts

region

required string literal
The AWS region of the target service. If endpoint is provided it will override this value since the endpoint includes the region.
Examples
"us-east-1"
Relevant when: endpoint = null

Environment variables

AWS_ACCESS_KEY_ID

common optional string literal
The AWS access key id. Used for AWS authentication when communicating with AWS services.
Examples
AKIAIOSFODNN7EXAMPLE

AWS_CONFIG_FILE

common optional string literal
Specifies the location of the file that the AWS CLI uses to store configuration profiles.
Default: ~/.aws/config

AWS_CREDENTIAL_EXPIRATION

common optional string literal
Expiration time in RFC 3339 format. If unset, credentials won’t expire.
Examples
1996-12-19T16:39:57-08:00

AWS_DEFAULT_REGION

common optional string literal
The default AWS region.
Examples
/path/to/credentials.json

AWS_PROFILE

common optional string literal
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
Examples
my-custom-profile

AWS_ROLE_SESSION_NAME

common optional string literal
Specifies a name to associate with the role session. This value appears in CloudTrail logs for commands performed by the user of this profile.
Examples
vector-session

AWS_SECRET_ACCESS_KEY

common optional string literal
The AWS secret access key. Used for AWS authentication when communicating with AWS services.
Examples
wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

AWS_SESSION_TOKEN

common optional string literal
The AWS session token. Used for AWS authentication when communicating with AWS services.
Examples
AQoEXAMPLEH4aoAH0gNCAPy...truncated...zrkuWJOgQs8IZZaIv2BXIa2R4Olgk

AWS_SHARED_CREDENTIALS_FILE

common optional string literal
Specifies the location of the file that the AWS CLI uses to store access keys.
Default: ~/.aws/credentials

Telemetry

Metrics

link

events_in_total

counter
The number of events accepted by this component either from tagged origin like file and uri, or cumulatively from other origins.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
container_name optional
The name of the container from which the event originates.
file optional
The file from which the event originates.
host required
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the event originates.
peer_path optional
The pathname from which the event originates.
pid required
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the event originates.
uri optional
The sanitized URI from which the event originates.

events_out_total

counter
The total number of events emitted by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

utilization

gauge
A ratio from 0 to 1 of the load on a component. A value of 0 would indicate a completely idle component that is simply waiting for input. A value of 1 would indicate a that is never idle. This value is updated every 5 seconds.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

Permissions

Platform: Amazon Web Services
Relevant policies
PolicyRequired forRequired when
cloudwatch:PutMetricData
  • healthcheck
  • operation

How it works

AWS authentication

Vector checks for AWS credentials in the following order:

  1. The access_key_id and secret_access_key options.
  2. The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.
  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 (only works if running on an EC2 instance with an instance profile/role).

If no credentials are found, Vector’s health check fails and an error is logged. If your AWS credentials expire, Vector will automatically search for up-to-date credentials in the places (and order) described above.

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.