This How to set error_logger_hwm in the new RabbitMQ .conf configuration file format? not suitable for my situation which running rabbitmq
(RabbitMQ 3.7.10 on Erlang 20.2.2 -- Ubuntu 16.04) by docker container.
I could add advanced.config in the host's directory, and update config.json for generating /var/lib/rabbitmq/config/generated/rabbitmq.config automatically after restart it.
root@*-pc:/etc/kolla/rabbitmq# cat advanced.config
[
{lager, [
{error_logger_hwm, 4000}
]}
].
root@*-pc:/etc/kolla/rabbitmq# cat config.json
{
"command": "/usr/sbin/rabbitmq-server",
"config_files": [
{
"source": "/var/lib/kolla/config_files/advanced.config",
"dest": "/etc/rabbitmq/advanced.config",
"owner": "rabbitmq",
"perm": "0600"
},
{
"source": "/var/lib/kolla/config_files/rabbitmq.conf",
"dest": "/etc/rabbitmq/rabbitmq.conf",
"owner": "rabbitmq",
"perm": "0600"
},
......
root@*-pc:/etc/kolla/rabbitmq# docker restart rabbitmq
rabbitmq
root@*-pc:/etc/kolla/rabbitmq# docker exec rabbitmq rabbitmqctl eval 'application:get_env(lager, error_logger_hwm).'
{ok,4000}
Question:
- Is there any command to set the environment parameter such as
'application:get_env(lager, error_logger_hwm).'
for get the environment parameter. Also can't find any clue at rabbitmq configuration.
# docker exec rabbitmq rabbitmqctl eval '[lager:set_loghwm(error_logger_hwm, 4000)]'
Error (argument validation): "syntax error before: "
Arguments given:
eval [lager:set_loghwm(error_logger_hwm, 4000)]
Usage:
rabbitmqctl [-n <node>] [-l] [-q] eval <expr>
It also seems doesn't raise the limit, I don't know what's that meaning. Reference from RabbitMQ lager_error_logger_h dropped messages.
# docker exec rabbitmq rabbitmqctl eval 'application:get_env(lager, error_logger_hwm).'
{ok,50}
# docker exec rabbitmq rabbitmqctl eval '[lager:set_loghwm(H, 4000) || H <- gen_event:which_handlers(lager_event)].'
[{last_loghwm,50},ok]
# docker exec rabbitmq rabbitmqctl eval 'application:get_env(lager, error_logger_hwm).'
{ok,50}
# docker exec rabbitmq rabbitmqctl eval '[lager:set_loghwm(H, 4000) || H <- gen_event:which_handlers(lager_event)].'
[{last_loghwm,4000},ok]
# docker exec rabbitmq rabbitmqctl eval 'application:get_env(lager, error_logger_hwm).'
{ok,50}
CodePudding user response:
enter code here
You can try rabbitmqctl eval 'application:set_env(lager,[{error_logger_hwm,4000}]).'
Maybe it works.
https://www.erlang.org/doc/man/application.html#set_env-2
lager:set_loghwm(error_logger_hwm, 4000)]
The above code does not work because lager
application doesn't start start and lager
's function can't be called.https://hexdocs.pm/lager/lager.html#set_loghwm-2