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

@@ -7,3 +7,4 @@ vector_config:
enbled: true
loki:
address: ""
extra_labels:

View File

@@ -13,7 +13,11 @@ transforms:
.process = ._COMM
.priority = .PRIORITY
.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:
loki:
type: loki
@@ -32,3 +36,8 @@ sinks:
process: "{{ .process }}"
priority: "{{ .priority }}"
{% 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 %}