Skip to content

Commit

Permalink
Merge pull request gliderlabs#171 from selimekizoglu/exclude-by-label
Browse files Browse the repository at this point in the history
Exclude containers by label.
  • Loading branch information
josegonzalez committed Jun 30, 2016
2 parents 685c7bc + 00147aa commit d56f003
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Expand Up @@ -41,7 +41,15 @@ To see what data is used for syslog messages, see the [syslog adapter](http://gi

You can tell logspout to ignore specific containers by setting an environment variable when starting your container, like so:-

$ docker run -d -e 'LOGSPOUT=ignore' image
$ docker run -d -e 'LOGSPOUT=ignore' image

Or, by adding a label which you define by setting an environment variable when running logspout:

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

#### Inspect log streams using curl

Expand Down
4 changes: 4 additions & 0 deletions router/pump.go
Expand Up @@ -60,6 +60,10 @@ func ignoreContainer(container *docker.Container) bool {
return true
}
}
excludeLabel := getopt("EXCLUDE_LABEL", "")
if value, ok := container.Config.Labels[excludeLabel]; ok {
return len(excludeLabel) > 0 && strings.ToLower(value) == "true"
}
return false
}

Expand Down

0 comments on commit d56f003

Please sign in to comment.