vuliad
vuliad

Reputation: 2152

Docker logs, stderr

Is it possible to separate docker logs between stderr \ stdout? Via fluentd\logstash etc. The ultimate goal - sending logs to elasticsearch and filter it by stderr\stdout

Upvotes: 2

Views: 3974

Answers (3)

wizzfizz94
wizzfizz94

Reputation: 1556

See latest from issue @Opal posted.

# stdout
docker logs container_name 2>/dev/null

# stderr
docker logs container_name >/dev/null

Upvotes: 0

repeatedly
repeatedly

Reputation: 718

If you want to separate docker logs into stdout processing and stderr processing in fluentd side, you can use rewite-tag-filter plugin with source value.

http://docs.fluentd.org/articles/out_rewrite_tag_filter

Upvotes: 2

user2915097
user2915097

Reputation: 32156

Maybe this is a duplicate of

https://github.com/docker/docker/issues/7440

Here is an example:

$ docker run -d --name foo busybox ls abcd
$ docker logs foo > stdout.log 2>stderr.log
$ cat stdout.log
$ cat stderr.log
ls: abcd: No such file or directory

Upvotes: 2

Related Questions