vector: added extra labels

This commit is contained in:
2025-12-09 01:15:43 +00:00
parent 26477cd2b2
commit 22ea077a16
2 changed files with 13 additions and 3 deletions

View File

@@ -6,4 +6,5 @@ vector_config:
journald: journald:
enbled: true enbled: true
loki: loki:
address: "" address: ""
extra_labels:

View File

@@ -13,7 +13,11 @@ transforms:
.process = ._COMM .process = ._COMM
.priority = .PRIORITY .priority = .PRIORITY
.host = "{{ vector_config.hostname }}" .host = "{{ vector_config.hostname }}"
{% if vector_config.extra_labels is defined and vector_config.extra_labels|length > 0 %}
{% for src in vector_config.extra_labels %}
{{ src.name }} = "{{ src.value }}"
{% endfor %}
{% endif %}
sinks: sinks:
loki: loki:
type: loki type: loki
@@ -31,4 +35,9 @@ sinks:
unit: "{{ .unit }}" unit: "{{ .unit }}"
process: "{{ .process }}" process: "{{ .process }}"
priority: "{{ .priority }}" priority: "{{ .priority }}"
{% endraw %} {% endraw %}
{% if vector_config.extra_labels is defined and vector_config.extra_labels|length > 0 %}
{% for src in vector_config.extra_labels %}
{{ src.label }}: "{% raw %}{{ {% endraw %}{{ src.name }}{% raw %} }}{% endraw %}"
{% endfor %}
{% endif %}