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

Log to file #1716

Open
lonix1 opened this issue Aug 5, 2023 · 0 comments
Open

Log to file #1716

lonix1 opened this issue Aug 5, 2023 · 0 comments

Comments

@lonix1
Copy link

lonix1 commented Aug 5, 2023

Is your feature request related to a problem?

Watchtower seems to log to stdout only, and thus to docker's built-in "json driver". The logs can be access like so:

  • $ docker logs -t $CONTAINER_NAME
  • tail -f /var/lib/docker/containers/$CONTAINER_ID/$CONTAINER_ID-json.log

When the container is recycled, the logs are lost. The workaround is to use another logging tool, but that is unnecessary complexity, especially for small deployments.

Also, in general, the logs are not in a friendly format - it's much simpler, especially in small deployments, to simply have the log in a file that can be easily manipulated. Not everyone uses large complex logging apps and servers, etc.

Describe the solution you'd like

Many apps have an option to log to file as well.

It would be nice if the log could be sent to a file instead of (or in addition to) stdout. If enabled, it could be written to /var/log/watchtower.log by default.

Personally, I would mount it as /var/log/watchtower.log:/var/log/watchtower.log so that I could have it on the host, and use logrotate on it.

And of course if one sends a USR1 signal to the app it should release and recreate the file (so the host can work on it, e.g. logrotate).

Describe alternatives you've considered

An unnecessarily complicated environment that includes log aggregation and monitoring, and who knows what else. For small servers that is overkill and hard to manage.

Additional context

Thank you for considering it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant