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

kubernetes.container_image and kubernetes.container_id labels not available for init containers in kubernetes_logs source #18665

Open
SHWETHABHAT1 opened this issue Sep 25, 2023 · 3 comments
Labels
type: bug A code related bug.

Comments

@SHWETHABHAT1
Copy link

SHWETHABHAT1 commented Sep 25, 2023

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

Currently for init containers we are seeing the container_image and container_image_id labels missing. One such example is from the canal pod. The same is also seen in the init-container of application pod as well. We see the image-name of the container of the canal pod in its config.

{"file":"/var/log/pods/kube-system_canal-<pod_name>_*****************/mount-bpffs/0.log","kubernetes":{"container_name":"mount-bpffs","namespace_labels":{"field.cattle.io/projectId":"#####","kubernetes.io/metadata.name":"kube-system"},"node_labels":{"beta.kubernetes.io/arch":"####","beta.kubernetes.io/instance-type":"####","beta.kubernetes.io/os":"###","failure-domain.beta.kubernetes.io/region":"####","failure-domain.beta.kubernetes.io/zone":"###","kubernetes.io/arch":"###","kubernetes.io/hostname":"node-name","kubernetes.io/os":"###","pod_ip":"###","pod_ips":["###"],"pod_labels":{"controller-revision-hash":"####","k8s-app":"canal","pod-template-generation":"1"},"pod_name":"canal-###","pod_namespace":"kube-system","pod_node_name":"node-name","pod_owner":"DaemonSet/canal","pod_uid":"####"},"message":"<data>.","source_type":"kubernetes_logs","stream":"stdout","timestamp_end":"time data"}

image

Configuration

Name:         vector
Namespace:    logging
Labels:       app.kubernetes.io/component=Agent
              app.kubernetes.io/instance=vector
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=vector
              app.kubernetes.io/version=0.30.0-distroless-libc
              helm.sh/chart=vector-0.22.1
Annotations:  meta.helm.sh/release-name: vector
              meta.helm.sh/release-namespace: logging

Data
====
vector.yaml:
----
data_dir: /vector-data-dir
sinks:
  loki-stdout:
    encoding:
      codec: json
    endpoint: <loki-endpoint>
    inputs:
    - stdout-logs
    labels:
      file: '{{ file }}'
      k8s_container_id: '{{ kubernetes.container_id }}'
      k8s_container_image: '{{ kubernetes.container_image }}'
      k8s_container_name: '{{ kubernetes.container_name }}'
      k8s_node_name: '{{ kubernetes.pod_node_name }}'
      k8s_node_os: '{{ kubernetes.node_labels."kubernetes.io/os" }}'
      k8s_pod_ip: '{{ kubernetes.pod_ip }}'
      k8s_pod_name: '{{ kubernetes.pod_name }}'
      k8s_pod_namespace: '{{ kubernetes.pod_namespace }}'
      k8s_pod_uid: '{{ kubernetes.pod_uid }}'
      source_type: '{{ source_type }}'
      stream: '{{ stream }}'
    out_of_order_action: accept
    tls:
      verify_certificate: false
      verify_hostname: false
    type: loki
sources:
  stdout-logs:
    type: kubernetes_logs

BinaryData
====

Events:  <none>

Version

0.30.0

Debug Output

ERROR sink{component_kind="sink" component_id=loki-testing component_type=loki component_name=loki-testing}: vector::     internal_events::template: Internal log [Failed to render template for "label_value "{{ kubernetes.container_image }}" with label_key "k8s_container_image"".] has been suppressed 7710 times.

ERROR sink{component_kind="sink" component_id=loki-testing component_type=loki component_name=loki-testing}: vector::     internal_events::template: Failed to render template for "label_value "{{ kubernetes.container_id }}" with label_key "k8s_container_id"". error     =Missing fields on event: ["kubernetes.container_id"] error_type="template_failed" stage="processing" internal_log_rate_limit=true

Example Data

No response

Additional Context

No response

References

#18627

@SHWETHABHAT1 SHWETHABHAT1 added the type: bug A code related bug. label Sep 25, 2023
@SHWETHABHAT1
Copy link
Author

@jszwedko Hi, were you able to reproduce this issue ? Is this being tracked somewhere ?

@jszwedko
Copy link
Member

jszwedko commented Oct 4, 2023

@jszwedko Hi, were you able to reproduce this issue ? Is this being tracked somewhere ?

I unfortunately haven't been able to reproduce this issue yet, but thank you for opening it!

@kefiras
Copy link

kefiras commented Nov 29, 2023

I am seeing the same for some of the init containers

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

3 participants