-
Notifications
You must be signed in to change notification settings - Fork 430
add RABBITMQ_LOG_LEVELS as a valid env var in docker-entrypoint.sh #187
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
Conversation
See #158 |
Please merge this PR. There is currently no way to set the logging level (even with a custom rabbitmq.config) since the config is overwritten by the entrypoint script. |
See docker-library/docs#1011 (the example of which is changing the value of |
The issue is that docker-library/docs#1011 does not actually work. |
@ilude can you please be more specific than "it doesn't work"? Your claim is a bit light on details. It is possible to inspect effective node configuration, see Verify Configuration in RabbitMQ docs. |
@tianon I think the downside of using
So this PR may be worth considering until 3.7.0 ships with the new config format which should be much easier for this image to manage, plus a separate "advanced configuration" file which can be used for really fine grained logger tuning. WDYT? |
here is a docker-compose.yml showing the RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS not working: https://gist.github.com/ilude/ba7a5a6df7decb369bfbdc4b562d5ad9 follow that with a docker-compose exec rabbitmq rabbitmqctl environment and you'll see that logging is still set to info. In addition (constructive criticism incoming, please don't read this as I'm mad or demanding anything) none of this is in anyway intuitive. Most images provide a way to configure logging without digging into closed comment threads for incomplete examples. And this is all coupled with the fact that your startup script does not allow a user of the image to easily override or add to the configuration file. Now having said all that my pull request was an attempt to make an easy way for image users to customize the log levels which is something I think many users would like to do. I would also be happy to submit a pull request on the docker hub docs for the image explaining the logging env setting and its use. Finally I would add that Pull request #174 and Pull request #53 should both be given serious consideration as they would make this image alot easier to customize to peoples needs. |
@ilude you've got an error in your diff --git a/docker-compose.yml b/docker-compose.yml
index 1c065fb..2c8596d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -5,4 +5,4 @@ rabbitmq:
- "5672:5672"
- "15672:15672"
environment:
- - RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS:"-rabbit log_levels [{connection, warning}, {channel, warning}]"
+ RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: "-rabbit log_levels [{connection,warning},{channel,warning}]" $ docker-compose exec -T rabbitmq rabbitmqctl environment | grep log_levels
{log_levels,[{connection,warning},{channel,warning}]}, Your point about usability is certainly not lost, but we're already a bit overboard on divergence from the upstream experience with the number of additional environment variables we support, so punting further configuration (and perhaps all configuration in 3.7+) to the upstream-supported methods is something we'd really like to do without really strong justification or explicit blessing from upstream to continue down the rabbit hole of extra environment variables that they don't officially support and know nothing about (and will inevitably get references to in bug reports to their project). |
Now that's strange, I get the following with the dash removed:
And the docs show that the dash is correct: https://docs.docker.com/compose/environment-variables/#setting-environment-variables-in-containers so perhaps this is a docker issue... more investigation needed... If you have a sec could you try this one and see (it sets things to version 3, which I forgot when I pasted the first one) Back to the issue at large: if 3.7 will address this then I can wait, and I sort of understand your desire to push this off. I'm using my own dockerfile now that incorporates my fix and the healtcheck, so its not a show stopper for me, but I would prefer not to manage my own rabbitmq images long term and instead rely on the official image. |
If you are using a version: '3'
services:
rabbitmq:
image: rabbitmq:3.6.12
hostname: rabbitmq
ports:
- "5672:5672"
- "15672:15672"
environment:
- "RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=-rabbit log_levels [{connection,warning},{channel,warning}]"
# or like this:
environment:
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: "-rabbit log_levels [{connection,warning},{channel,warning}]" |
Thanks @yosifkit it's now working with the following docker-compose.yml.
The spaces were the root of my troubles and sub-optimal user experience. They are not an issue within the configuration file for rabbitmq, so I would have never guessed that they would be an issue when passed via the command line (That's my lack of Erlang knowledge, I know). |
Still can't get this working with docker-compose. Using @ilude's environment setting I am still seeing the |
Note that the |
@kernel-sanders I know this is not the answer your are looking for but I'm in a mood to be particularly annoying: do not disable those "spam" log entries. They will be very handy next time — and it's a matter of when, not if — you have to investigate a problem with one of your applications. Unless you collect a really large number of metrics, including connection attempts/successes/failures per app e.g. using rabbitmq-event-exchange, connection lifecycle events in the log are really useful. |
@kernel-sanders your config (assuming you didn't get the nesting wrong which with A generic UNIX package node started as
logs
but when I open a connection from a REPL, it is not logged even though it does send data. Is there a way to disable those entries in 3.6.x? There is no. In 3.7.0 there might be since logging And I don't consider it to be a problem: we see a lot of questions from RabbitMQ users that can be fairly quickly answered after a glance at the log. If all plugin activation, protocol listener and log/data/config file information were gone from the log, there would be little to work with when troubleshooting. |
@michaelklishin I appreciate you taking the time to explain this. |
@michaelklishin your points on logging are valid for a production system, and there I would have the logging set to info or even debug. But, at least for me, production logging is pushed into a logging pipeline that allows filtering of that messaging. In a dev environment build on docker-compose everything gets dumped to STDOUT. So its very nice to be able to turn logging down on parts of the system you are not actually developing against. |
Allows setting of log levels via environment variable