Open erbrecht opened 5 years ago
I got this working locally and submitted a pull request, but it failed the circleci tests. The image was too large. From what I can tell it was about 62 MB. Building the image locally, using make build
, created a 36 MB image. I did need to add an import for github.com/docker/docker/api/types/swarm into glide.yaml. I must be doing something wrong and it's a bit frustrating because other than the new dependency, I only modified 2 files. Did my changes really inflate the size that much, or am I missing something?
I've been evaluating logspout and it has been meeting all my needs until now. I'm able to use filter.labels to only include logs from containers with certain labels. My next step was to try this out in swarm mode. It seems that labels in swarm mode apply to the service, not individual containers. I can inspect containers created by the
docker stack deploy
command, and they don't have the labels defined in my yml file. These are the labels I had been using in the filter.labels parameter. Those labels DO exist when I inspect the service created bydocker stack deploy
. Since my individual containers don't have these labels, I get not logs through logspout. If I remove the filter.labels parameter, I get logs from my containers, but the log entries don't include my custom labels either, only the labels the stack applies to the container.Labels for a container running as part of a stack:
And labels for the service, which has the id in the
com.docker.swarm.service.id
label from above:A log entry from a (different) container showing just the
com.docker.stack
andcom.docker.swarm
labels:Is it possible to check labels for a given service, and filter container logs accordingly? I know that traefik relies heavily on labels, and it's able to detect when a service starts up with given labels. I know it's a different project, and different authors, but it's a similar situation in terms of dealing with swarm mode. Perhaps specifically telling logspout it is operating in a swarm so it knows to check for services instead of just containers? I would take a crack at it but I haven't wrapped my head around the code enough to know where to start.