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
- Common
- Advanced
- vector.toml
- vector.yaml
- vector.json
[transforms.my_transform_id]type = "metric_to_log" # requiredinputs = ["my-source-or-transform-id", "prefix-*"] # requiredhost_tag = "hostname" # optional, default
- commonoptionalstring
host_tag
Tag key that identifies the source host.
- Syntax:
literal
- Default:
"hostname"
- View examples
- Syntax:
- optionalstring
timezone
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, orlocal
to indicate system local time.- Syntax:
literal
- Default:
"local"
- View examples
- Syntax:
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 errorinstance
- 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 errorinstance
- 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:
[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.