diff --git a/README.md b/README.md index bf1a5f47..8c494b27 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The simplest way to use logspout is to just take all logs and ship to a remote s gliderlabs/logspout \ syslog://logs.papertrailapp.com:55555 -logspout will gather logs from other containers that are started **without the `-t` option**. +logspout will gather logs from other containers that are started **without the `-t` option** and are configured with a logging driver that works with `docker logs` (`journald` and `json-file`). To see what data is used for syslog messages, see the [syslog adapter](http://github.com/gliderlabs/logspout/blob/master/adapters) docs. diff --git a/router/pump.go b/router/pump.go index 6012cea7..9f50ac20 100644 --- a/router/pump.go +++ b/router/pump.go @@ -53,6 +53,15 @@ func normalID(id string) string { return id } +func logDriverSupported(container *docker.Container) bool { + switch container.HostConfig.LogConfig.Type { + case "json-file", "journald": + return true + default: + return false + } +} + func ignoreContainer(container *docker.Container) bool { for _, kv := range container.Config.Env { kvp := strings.SplitN(kv, "=", 2) @@ -144,6 +153,10 @@ func (p *LogsPump) pumpLogs(event *docker.APIEvents, backlog bool) { debug("pump.pumpLogs():", id, "ignored: environ ignore") return } + if !logDriverSupported(container) { + debug("pump.pumpLogs():", id, "ignored: log driver not supported") + return + } var sinceTime time.Time if backlog {