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

added the ability to include only container having label using INCLUDE_LABEL param #222

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ Or, by adding a label which you define by setting an environment variable when r
gliderlabs/logspout
$ docker run -d --label logspout.exclude=true image

#### Including specific containers
#### Including explicit containers

You can tell logspout to only include certain containers by setting filter parameters on the URI:
You can tell logspout to include explicit containers by adding, for each container, a label which you define by setting an environment variable when running logspout:

$ docker run --name="logspout" \
-e INCLUDE_LABEL=logspout.include \
--volume=/var/run/docker.sock:/var/run/docker.sock \
gliderlabs/logspout
$ docker run -d --label logspout.include=true image

#### Routing specific containers

You can tell logspout to only route certain containers by setting filter parameters on the URI:

$ docker run \
--volume=/var/run/docker.sock:/var/run/docker.sock \
Expand Down
4 changes: 4 additions & 0 deletions router/pump.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func ignoreContainer(container *docker.Container) bool {
if value, ok := container.Config.Labels[excludeLabel]; ok {
return len(excludeLabel) > 0 && strings.ToLower(value) == "true"
}
includeLabel := getopt("INCLUDE_LABEL", "")
if _, ok := container.Config.Labels[includeLabel]; (includeLabel != "" && !ok) {
return true
}
return false
}

Expand Down