Skip to content
Discussion options

You must be logged in to vote

You should not need Lua, curl, jq, the scheduled exec source, or the memory table for this label. The value fetched by the fallback is exactly a Pod label, and Vector's kubernetes_logs source already watches Pods through the Kubernetes API and adds their labels to each log event under .kubernetes.pod_labels.

Replace the generic file source with kubernetes_logs and read the label in VRL:

sources:
  logs:
    type: kubernetes_logs
    self_node_name: ${VECTOR_SELF_NODE_NAME}
    # Keep metadata longer for logs drained after a Pod is deleted.
    delay_deletion_ms: 300000

transforms:
  set_app:
    type: remap
    inputs:
      - logs
    source: |
      if exists(.kubernetes.pod_labels."ap…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pront
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
transform: lua Anything `lua` transform related domain: enriching Anything related to enriching Vector's events with context data source: kubernetes_logs Anything `kubernetes_logs` source related platform: kubernetes Anything `kubernetes` platform related
2 participants