How to parse labels of the format kubernetes.io/name: my-app
#13511
Answered
by
spencergilbert
suryaoruganti
asked this question in
Q&A
-
I am pushing logs from a This configuration works except for the app_k8s_name: '{{`{{kubernetes.pod_labels.app.kubernetes.io/name}}`}}' The relevant config in context is here: customConfig:
sinks:
loki:
type: loki
inputs:
- kubernetes
endpoint: http://loki:3100
compression: none
encoding:
codec: json
labels:
forwarder: vector
job: kubernetes
namespace: "{{`{{kubernetes.pod_namespace}}`}}"
pod_name: "{{`{{kubernetes.pod_name}}`}}"
pod_owner: "{{`{{kubernetes.pod_owner}}`}}"
container_name: "{{`{{kubernetes.container_name}}`}}"
container_image: "{{`{{kubernetes.container_image}}`}}"
app: "{{`{{kubernetes.pod_labels.app}}`}}"
app_k8s_name: '{{`{{kubernetes.pod_labels.app.kubernetes.io/name}}`}}'
out_of_order_action: "accept"
remove_timestamp: true
acknowledgements:
enabled: false
tenant_id: "kubernetes"
sources:
kubernetes:
type: kubernetes_logs
auto_partial_merge: true
self_node_name: ${VECTOR_SELF_NODE_NAME}
max_read_bytes: 2048
max_line_bytes: 32768
fingerprint_lines: 1
glob_minimum_cooldown_ms: 60000
delay_deletion_ms: 60000
timezone: local
data_dir: /vector-data-dir Any pointers on how this can be resoled? |
Beta Was this translation helpful? Give feedback.
Answered by
spencergilbert
Jul 12, 2022
Replies: 1 comment 1 reply
-
Hi @suryaoruganti - you can see the grammar and valid characters for paths here and further down, quoted paths to handle those cases. So, the path for that label is: |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
spencergilbert
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @suryaoruganti - you can see the grammar and valid characters for paths here and further down, quoted paths to handle those cases.
So, the path for that label is:
kubernetes.pod_labels."app.kubernetes.io/name"