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
Feature: Ability to clear log history #1083
Comments
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 |
👍 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. |
Docker 1.6 will add support for logging drivers, see moby/moby#10568 (currently; JSON, syslog and "none") work is in progress for basic log-rotation; moby/moby#11485 |
Good to hear that, thanks a lot :) |
Thanks for the background and update on Docker 1.6 - looking forward to it! |
To revisit again when docker figure things out at: docker/compose#1083 moby/moby#11485
To revisit again when docker figure things out at: docker/compose#1083 moby/moby#11485
+1 |
+1 Really important |
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. |
+1 |
3 similar comments
+1 |
+1 |
👍 |
+1 |
+2 |
+1 |
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:
|
@dmage Thanks, exactly what I need. |
+1000 |
+1 would LOVE this |
+1 |
@dmage solution works great for us. Those others who are +1ing this, what is wrong with the solution that he's given? |
@Rodeoclash - I think one use case for this is reuse of a given set of containers for a new run i.e. CI test run. The old logs are irrelevant to the new run, so a |
+1 |
+1, same need as @rosskevin |
Ok, to recap:
Going to close this since it's already support or tracked in other issues. |
+1 |
1 similar comment
+1 |
I made a simple script docker_clear_log.sh: |
+1 I also tried to temp solution and it appears to work |
The original issue was never resolved and the issue was closed anyway. Interesting. @djessup , how do you like those apples? |
would still be nice to have a docker-compose logs --clean |
Why has this issue been closed without even a comment when the issue in itself has not been solved? |
When I came to this thread, the closing comment had been folded into other comments. It's right here: I think they're hoping to cover this particular use case through indirect means. Mention you're particular use case and how it's not covered, and it might help the ticket be re-opened. Worst case, someone might point out an easy way to get what you want :D |
'docker-compose restart server' seems to replay all the logs, which on my mac had reached 125M and it took quite a while to replay that much data to the terminal. Found on: docker/compose#1083 (comment) and documented here: https://docs.docker.com/config/containers/logging/json-file/#options
Any updates? |
when there is a log, we should be able to clear it in a simple way. would be really nice, if you could build the command into it. this seems not hard. |
If you use docker-compose, use lazydocker for viewing logs. Then there is then no need to delete logs. You get live logs and start with the latest logs. This helps very much with debugging. https://github.com/jesseduffield/lazydocker But the workaround with lazy docker does it for me. Thank you jesseduffield for giving us the possibility to be lazy with your monitoring tool :-) |
+2147483647 |
+49324893 |
This is such a central problem with UX of docker-compose, I wonder why it has not been resolved. Every time I run docker-compose up, some of the new logs are put on the top of super old logs from 5 starts ago. What is this? |
This issue should be re-open. |
I would love to use this as well. Why can't there be a simple |
Echoing everyone here lol |
A simple workaround for me is using |
@eon01 Awesome hack! Thanks for sharing |
7 years passed. |
Please add this!!! |
Please add this! And reopen this issue! |
sudo sh -c "truncate -s 0 /var/lib/docker/containers/**/*-json.log" |
This comment was marked as off-topic.
This comment was marked as off-topic.
+1 |
It would make even more sense if you can
so it cleans logs for whole stack also archiving in production environments would be nice |
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]
The text was updated successfully, but these errors were encountered: