This is documentation for the next version of Alloy. For the latest stable release, go to the latest version.
loki.enrich
EXPERIMENTAL: This is an experimental component. Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement. The
stability.level
flag must be set toexperimental
to use the component.
The loki.enrich
component enriches logs with additional labels from service discovery targets.
It matches a label from incoming logs against a label from discovered targets, and copies specified labels from the matched target to the log entry.
Usage
loki.enrich "<LABEL>" {
// List of targets from a discovery component
targets = <DISCOVERY_COMPONENT>.targets
// Which label from discovered targets to match against
match_label = "<LABEL>"
// Which label from incoming logs to match against
source_label = "<LABEL>"
// List of labels to copy from discovered targets to logs
labels_to_copy = ["<LABEL>", ...]
// Where to send enriched logs
forward_to = [<RECEIVER_LIST>]
}
Arguments
The following arguments are supported:
Blocks
The loki.enrich
component doesn’t support any blocks. You can configure this component with arguments.
Exports
The following values are exported:
Example
Component Behavior
The component matches logs to discovered targets and enriches them with additional labels:
- For each log entry, it looks up the value of
logs_match_label
from the log’s labels ortarget_match_label
iflogs_match_label
is not specified. - It matches this value against the
target_match_label
in discovered targets. - If a match is found, it copies the requested
labels_to_copy
from the discovered target to the log entry. Iflabels_to_copy
is empty, all labels are copied. - The log entry, enriched or unchanged, is forwarded to the configured receivers.
Caution
By default,
loki.enrich
is ready as soon as it starts, even if no targets have been discovered. If telemetry is sent to this component before the metadata is synced, then it will be passed though as-is, without enrichment. This is most likely to impactloki.enrich
on startup for a short time before thediscovery
components have sent a new list of targets.
Compatible components
loki.enrich
can accept arguments from the following components:
- Components that export Targets
- Components that export Loki
LogsReceiver
loki.enrich
has exports that can be consumed by the following components:
- Components that consume Loki
LogsReceiver
Note
Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.