Metric to Log Transform

The Vector metric_to_log transform converts a metric event into a log event, which can be useful for sending metrics to log-support downstream components.

Configuration

[transforms.my_transform_id]
type = "metric_to_log" # required
inputs = ["my-source-or-transform-id", "prefix-*"] # required
host_tag = "hostname" # optional, default
  • commonoptionalstring

    host_tag

    Tag key that identifies the source host.

    • Syntax: literal
    • Default: "hostname"

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

    processing_errors_total

    The total number of processing errors encountered 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.

    • error_type - The type of the error

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

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

  • counter

    events_in_total

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

  • 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

    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.

  • 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.

Examples

Given the following Vector metric event:

{
"kind": "absolute",
"name": "histogram",
"timestamp": "2020-08-01T21:15:47+00:00",
"tags": {
"host": "my.host.com",
"code": "200"
},
"histogram": {
"buckets": [
{
"upper_limit": 1.0,
"count": 10
},
{
"upper_limit": 2.0,
"count": 20
}
],
"count": 30,
"sum": 50.0
}
}

And the following configuration:

vector.toml
[transforms.metric_to_log]
type = "metric_to_log"
host_tag = "host"

The following Vector log event will be output:

{
"name": "histogram",
"timestamp": "2020-08-01T21:15:47+00:00",
"host": "my.host.com",
"tags": {
"code": "200"
},
"kind": "absolute",
"histogram": {
"buckets": [
{
"count": 10,
"upper_limit": 1.0
},
{
"count": 20,
"upper_limit": 2.0
}
],
"count": 30,
"sum": 50.0
}
}

How It Works

State

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