Metric to log
Convert metric events to log events
Configuration
Example configurations
{
"transforms": {
"my_transform_id": {
"type": "metric_to_log",
"inputs": [
"my-source-or-transform-id"
]
}
}
}
[transforms.my_transform_id]
type = "metric_to_log"
inputs = [ "my-source-or-transform-id" ]
transforms:
my_transform_id:
type: metric_to_log
inputs:
- my-source-or-transform-id
{
"transforms": {
"my_transform_id": {
"type": "metric_to_log",
"inputs": [
"my-source-or-transform-id"
],
"host_tag": "host",
"metric_tag_values": "single",
"timezone": "local"
}
}
}
[transforms.my_transform_id]
type = "metric_to_log"
inputs = [ "my-source-or-transform-id" ]
host_tag = "host"
metric_tag_values = "single"
timezone = "local"
transforms:
my_transform_id:
type: metric_to_log
inputs:
- my-source-or-transform-id
host_tag: host
metric_tag_values: single
timezone: local
host_tag
optional string literalName of the tag in the metric to use for the source host.
If present, the value of the tag is set on the generated log event in the host
field,
where the field key uses the global host_key
option.
inputs
required [string]A list of upstream source or transform IDs.
Wildcards (*
) are supported.
See configuration for more info.
metric_tag_values
optional string literal enumControls how metric tag values are encoded.
When set to single
, only the last non-bare value of tags are displayed with the
metric. When set to full
, all metric tags are exposed as separate assignments as
described by the native_json
codec.
Option | Description |
---|---|
full | All tags are exposed as arrays of either string or null values. |
single | Tag values are exposed as single strings, the same as they were before this config option. Tags with multiple values show the last assigned value, and null values are ignored. |
single
timezone
optional string literalThe 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.
Outputs
<component_id>
Telemetry
Metrics
linkcomponent_discarded_events_total
counterfilter
transform, or false if due to an error.component_errors_total
countercomponent_received_event_bytes_total
countercomponent_received_events_count
histogramA histogram of the number of events passed in each internal batch in Vector’s internal topology.
Note that this is separate than sink-level batching. It is mostly useful for low level debugging performance issues in Vector due to small internal batches.
component_received_events_total
countercomponent_sent_event_bytes_total
countercomponent_sent_events_total
counterutilization
gaugeExamples
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"
}
}
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"
}
}
}
{
"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"
}