Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loki sink: Labels with "-" in them seemingly ignored. #14763

Closed
jaqb76 opened this issue Oct 7, 2022 · 1 comment
Closed

Loki sink: Labels with "-" in them seemingly ignored. #14763

jaqb76 opened this issue Oct 7, 2022 · 1 comment
Labels
type: bug A code related bug.

Comments

@jaqb76
Copy link

jaqb76 commented Oct 7, 2022

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

It looks like labels with dash "-" in them are ignored by the loki sink. e.g.

application = '{{ kubernetes.pod_labels.app-name }}'

does not create the application label.

Actual Behavior

label.application is missing.

Expected Behavior

application = '{{ kubernetes.pod_labels.app-name }}'

Configuration

loki_sink:
        compression: gzip
        remove_label_fields: true
        encoding:
          codec: json
        endpoint: https://loki-xxxx
        inputs:
        - kubernetes_logs
        labels:
          clustername: test_cluster
          container: '{{ kubernetes.container_name }}'
          forwarder: vector
          host: '{{ kubernetes.pod_node_name }}'
          namespace: '{{ kubernetes.pod_namespace }}'
          pod: '{{ kubernetes.pod_name }}'
          app: '{{ kubernetes.pod_labels.app }}'
          application: '{{ kubernetes.pod_labels.app-name }}'
          release: '{{ kubernetes.pod_labels.release }}'
          pod_uid: '{{ kubernetes.pod_uid }}'
          region: us-east-2
          pod_labels: '{{kubernetes.pod_labels}}'
        type: loki

Version

INFO vector: Vector has started. debug="false" version="0.24.0" arch="x86_64" build_id="43267b9 2022-08-30"

Debug Output

No response

Example Data

Screenshot from 2022-10-07 12-37-09

Additional Context

References

No response

@jaqb76 jaqb76 added the type: bug A code related bug. label Oct 7, 2022
@spencergilbert
Copy link
Contributor

👋

Hi there, try this template syntax instead:

- application = '{{ kubernetes.pod_labels.app-name }}'
+ application = '{{ kubernetes.pod_labels."app-name" }}

We've been updating how Vector looks up paths to be aligned with VRL, unfortunately it looks like the docs around template syntax and field path notation weren't updated at the time of the change. I'm writing a pull request to address that now, but it should be replaced by path expressions.

Additionally the compile time checking of these paths is incomplete and is tracked by #13033 which we are hoping to tackle this quarter.

Let me know if this doesn't solve the problem and I'll reopen the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A code related bug.
Projects
None yet
Development

No branches or pull requests

2 participants