compose icon indicating copy to clipboard operation
compose copied to clipboard

Feature: Ability to clear log history

Open djessup opened this issue 11 years ago • 158 comments

A feature I've thought would be useful since originally using Fig, and now Compose would be the ability to clear the log history for Composed-managed containers. Long-running or "chatty" containers can end up with a lot of log noise that may not be wanted.

I'd expect a command like the following would solve the problem: $ docker-compose logs --clear [service]

djessup avatar Mar 09 '15 02:03 djessup

I don't think that is a feature supported by the docker daemon. Looking at the api docs, the only option would be to truncate the returned logs to a limited number of lines per container:

https://docs.docker.com/reference/api/docker_remote_api_v1.17/#get-container-logs

dnephin avatar Mar 13 '15 03:03 dnephin

:+1: for this issue. I actually use compose to develop a website in Golang, Mongodb and nginx... 5 days after begining I have a long logs that becomes to be worrying. Each time I restart containers append many lines to the log. @dnephin I don't understand if you give a solution (that I don't understand :)) or if you propose to check if it's possible with api. Sorry for my bad english.

metal3d avatar Apr 09 '15 20:04 metal3d

Docker 1.6 will add support for logging drivers, see https://github.com/docker/docker/pull/10568 (currently; JSON, syslog and "none") work is in progress for basic log-rotation; https://github.com/docker/docker/pull/11485

thaJeztah avatar Apr 09 '15 21:04 thaJeztah

Good to hear that, thanks a lot :)

metal3d avatar Apr 13 '15 00:04 metal3d

Thanks for the background and update on Docker 1.6 - looking forward to it!

djessup avatar Apr 17 '15 12:04 djessup

docker logs -c (clear) <container> would be great.

+1

sgarbesi avatar Jul 16 '15 05:07 sgarbesi

+1 Really important

baptistedonaux avatar Sep 11 '15 15:09 baptistedonaux

Holy cow, I just sat through several minutes of logs to get to the end. I'd really appreciate this as well for the sake of not having to rebuild containers constantly.

egyptianbman avatar Sep 14 '15 22:09 egyptianbman

+1

jghibiki avatar Sep 15 '15 16:09 jghibiki

+1

vronin avatar Sep 15 '15 17:09 vronin

+1

junajan avatar Sep 17 '15 11:09 junajan

:+1:

knutole avatar Sep 18 '15 13:09 knutole

+1

Rodeoclash avatar Sep 20 '15 23:09 Rodeoclash

+2

nafg avatar Sep 21 '15 06:09 nafg

+1

FnTm avatar Sep 21 '15 09:09 FnTm

Just for the record, with Docker 1.8 and docker-compose 1.4 there is already exists a method to limit log size using https://docs.docker.com/compose/yml/#log-driver and log-opt max-size:

  log_driver: "json-file"
  log_opt:
    max-size: "100k"
    max-file: "20"

dmage avatar Sep 21 '15 10:09 dmage

@dmage Thanks, exactly what I need.

knutole avatar Sep 21 '15 10:09 knutole

+1000

OlivierCuyp avatar Oct 06 '15 09:10 OlivierCuyp

+1 would LOVE this

sheyman avatar Oct 11 '15 05:10 sheyman

+1

joegoggins avatar Oct 12 '15 21:10 joegoggins