Metricbeat docker module container labels are missing for Docker API

Metricbeat version: 7.1.1
We have configured Metricbeat with Docker API instead of Unix Socket in metricbeat.yml
We are able to get container, cpu,
emory, stats etc.

Each Metrics consist of cpu stats, container id, container image, container name however container labels are missing.
a
We also tried configuring the add_docker_metadata to get additional details related to container based on container id. After configuration, metricbeat service startup will fail with panic. I suspect its a bug where Metricbeat docker metadata only works if metricbeat is configured locally with unix socket. It will fail if configured with remote docker API.

Can you please help to confirm if its a bug or if I am missing some configuration.

My requirement is to get the container labels for cpu, memory , diskio, network stats which currently is not available. I can only see container id, name, image related to this stats.

Hi @aviratna,

That panic doesn't look good, let's try to fix it, could you open a new issue here? https://github.com/elastic/beats/issues/new

As per the labels, I'm not aware of any issue retrieving labels using the API, what version of docker are you suing?

Best regards

Hi @exekias,

Thanks for the response.

I have raised a issue on github for docker metadata: https://github.com/elastic/beats/issues/12524

And regarding Docker label in Metricset please find details below.

We are using Docker API version: 1.25

I also verified the remote docker API inspect command to check if docker container labels are returned in response. Docker Label is available in API response.

curl -k "https://"Remote Docker API Endpoint":2376/v1.24/containers/"container id"/json" --cacert "ca.pem" --key "key.pem" --cert "cert.pem"

I was expecting output as per below document. However we are able to fetch all stats, container.id, container.name, container.image but highlighted section (docker.container.labels ) is missing.

Kindly let me know if I am missing some configuration to view docker labels in metricset.

https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-metricset-docker-cpu.html