Skip to content
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

[Question] Is there a way to limit the size of the logs? #7434

Closed
yamrzou opened this issue Aug 25, 2020 · 11 comments · Fixed by #7931
Closed

[Question] Is there a way to limit the size of the logs? #7434

yamrzou opened this issue Aug 25, 2020 · 11 comments · Fixed by #7931
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@yamrzou
Copy link

yamrzou commented Aug 25, 2020

/kind feature

Is there a way to make sure container logs do not grow indefinitely?
Would it be safe to remove ~/.local/share/containers/storage/overlay-containers/*/userdata/ctr.log while the container is running?

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 25, 2020
@mheon
Copy link
Member

mheon commented Aug 25, 2020

There is a maximum log size for containers, in bytes, defined in containers.conf - it is defaulted to -1, unlimited. I believe setting that should accomplish what you're looking for?

@TomSweeneyRedHat
Copy link
Member

If so, this might be a good entry for the troubleshooting guide....

@yamrzou
Copy link
Author

yamrzou commented Aug 26, 2020

Thank you, yes that's should accomplish what I'm looking for.

@rhatdan
Copy link
Member

rhatdan commented Aug 27, 2020

Labeling this as containers.conf, since I should write this up in the forthcoming blog on containers.conf.

@Luap99
Copy link
Member

Luap99 commented Aug 28, 2020

I just want to add that docker uses --log-opt for this. https://docs.docker.com/config/containers/logging/json-file/#options
docker run -it --log-opt max-size=10m --log-opt max-file=3 alpine ash
This might be worth mentioning.

@vrothberg
Copy link
Member

@rhatdan, did you add that to the blog? Can we close the issue?

@rhatdan
Copy link
Member

rhatdan commented Sep 8, 2020

I have not written any blogs yet. Too much vacationing.

@rhatdan
Copy link
Member

rhatdan commented Oct 6, 2020

I opened this related PR. containers/conmon#211

@pmoogi-redhat
Copy link

pmoogi-redhat commented Dec 7, 2020

Hello @rhatdan . For my simulations on log-loss i needed to change limit on log size - so created changes in my branch as master...pmoogi-redhat:supportforlogsizemax for enabling --log-opt max-size=xx option. It is found working fine as expected. i did some validation on log files written onto disk. This is my first change to podman repo. Kindly let me know if PR can be submitted here reflecting this change in case you find it useful and if it doesn't hurt other modules which are dependent on this repo.

@mheon
Copy link
Member

mheon commented Dec 7, 2020

That change looks fine on the whole, feel free to make a PR and we can see about getting it landed.

@rhatdan
Copy link
Member

rhatdan commented Dec 7, 2020

Yes @pmoogi-redhat Open a PR.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants