Skip to content

CONTAINER_NAME doesn't output the correct "io.kubernetes.container.name" label #336

@ankitdbst

Description

@ankitdbst

With docker, the below daemon.json for journald:

{
    "log-driver": "journald",
    "log-opts": {
      "tag":"{{.ID}}",
      "labels": "io.kubernetes.container.name,io.kubernetes.pod.name"
    }
}

We can filter journalctl logs by IO_KUBERNETES_CONTAINER_NAME=<container-name>. Where container-name is the one defined in the k8s manifest.

      ...
      containers:
      - args:
        ...
        name: kafka

In crio, when logging to journald, the CONTAINER_NAME filter outputs the pod name instead along with some hash:

k8s_kafka_kafka-0_default_4067521d-941e-460a-b8c0-8ec98ecb9dd0_0

Is there a way to configure the fields we send to journald like docker does? So that we can have only kafka returned when doing the filter match?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions