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

Improve the logging #336

Open
greg0ire opened this issue Jul 19, 2023 · 0 comments
Open

Improve the logging #336

greg0ire opened this issue Jul 19, 2023 · 0 comments

Comments

@greg0ire
Copy link

In my company, we use envconsul in Docker entrypoint, as follows:

envconsul /path/to/some/binary

We use AWS's spot instances, which means our cronjob might get interrupted (as in, envconsul will receive a SIGTERM) at any time. Our SRE team knows about this, and did communicate with our development team about it, but it's hard to keep that in mind.

So when an interruption happens, we get very few logs. Some of them are from containerd, saying that Task xxxx has exited with exit code 12, and before that, we get a log from envconsul, that says: Cleaning up..., and that's it:

envconsul/cli.go

Lines 186 to 189 in d39537a

case *cfg.KillSignal:
fmt.Fprintf(cli.errStream, "Cleaning up...\n")
runner.Stop()
return ExitCodeInterrupt

Now when using unix tools, there seems to be a handy convention that consists in printing the name of the tool that encounters an error, that way, if you have an error in a pipeline, there is some indication about what tool is having an issue:

$ echo 'hi'|grep a b
grep: b: No such file or directory

I have 2 suggestions:

  1. Improve the logging so that every log is prefixed with envconsul: or add a flag allowing to do so.
  2. Improve that particular log so that it includes the Signal that was received: Received SIGTERM. Cleaning up...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant