Metric to log

Convert metric events to log events

status: stable egress: stream state: stateless

Configuration

Example configurations

{
  "transforms": {
    "my_transform_id": {
      "type": "metric_to_log",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "host_tag": "hostname"
    }
  }
}
[transforms.my_transform_id]
type = "metric_to_log"
inputs = [ "my-source-or-transform-id" ]
host_tag = "hostname"
---
transforms:
  my_transform_id:
    type: metric_to_log
    inputs:
      - my-source-or-transform-id
    host_tag: hostname
{
  "transforms": {
    "my_transform_id": {
      "type": "metric_to_log",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "host_tag": "hostname",
      "timezone": "local"
    }
  }
}
[transforms.my_transform_id]
type = "metric_to_log"
inputs = [ "my-source-or-transform-id" ]
host_tag = "hostname"
timezone = "local"
---
transforms:
  my_transform_id:
    type: metric_to_log
    inputs:
      - my-source-or-transform-id
    host_tag: hostname
    timezone: local

host_tag

common optional string
Tag key that identifies the source host.
default: hostname

inputs

required [string]

A list of upstream source or transform IDs. Wildcards (*) are supported but must be the last character in the ID.

See configuration for more info.

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

timezone

optional string
The name of the time zone to apply to timestamp conversions that do not contain an explicit time zone. This overrides the global timezone option. The time zone name may be any name in the TZ database, or local to indicate system local time.
default: local

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_kind required
The Vector component kind.
component_name required
The Vector component name.
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.
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.
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_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

processed_bytes_total

counter
The number of bytes processed by the component.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.
container_name optional
The name of the container from which the bytes originate.
file optional
The file from which the bytes originate.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the bytes originate.
peer_path optional
The pathname from which the bytes originate.
pod_name optional
The name of the pod from which the bytes originate.
uri optional
The sanitized URI from which the bytes originate.

processed_events_total

counter
The total number of events processed by this component. This metric is deprecated in place of using events_in_total and events_out_total metrics.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

processing_errors_total

counter
The total number of processing errors encountered by this component.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.
error_type required
The type of the error

Examples

Metric To Log

Given this event...
{
  "metric": {
    "histogram": {
      "buckets": [
        {
          "count": 10,
          "upper_limit": 1
        },
        {
          "count": 20,
          "upper_limit": 2
        }
      ],
      "count": 30,
      "sum": 50
    },
    "kind": "absolute",
    "name": "histogram",
    "tags": {
      "code": "200",
      "host": "my.host.com"
    },
    "timestamp": "2020-08-01T21:15:47+00:00"
  }
}
...and this configuration...
[transforms.my_transform_id]
type = "metric_to_log"
inputs = [ "my-source-or-transform-id" ]
host_tag = "host"
---
transforms:
  my_transform_id:
    type: metric_to_log
    inputs:
      - my-source-or-transform-id
    host_tag: host
{
  "transforms": {
    "my_transform_id": {
      "type": "metric_to_log",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "host_tag": "host"
    }
  }
}
...this Vector event is produced:
{
  "log": {
    "histogram": {
      "buckets": [
        {
          "count": 10,
          "upper_limit": 1
        },
        {
          "count": 20,
          "upper_limit": 2
        }
      ],
      "count": 30,
      "sum": 50
    },
    "host": "my.host.com",
    "kind": "absolute",
    "name": "histogram",
    "tags": {
      "code": "200"
    },
    "timestamp": "2020-08-01T21:15:47+00:00"
  }
}

How it works

State

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