rabbitmq / rabbitmq-server

Open source RabbitMQ: core server and tier 1 (built-in) plugins
https://www.rabbitmq.com/
Other
12.35k stars 3.92k forks source link

RabbitMQ 3.7.4 - lager_syslog_backend failing to install #1555

Closed jaredledvina closed 6 years ago

jaredledvina commented 6 years ago

System Info:

Hi! I'm trying to configure RabbitMQ to log natively to syslog, reading through https://www.rabbitmq.com/logging.html it seems like this should be simple and only require me adding the {log, [{syslog, [{enabled, true}]}]}, section to the config. However, after doing so, and restarting rabbitmq-server I get the following in the RabbitMQ logs:

2018-03-15 15:26:05.771 [error] <0.99.0> Lager failed to install handler lager_syslog_backend into lager_event, retrying later : {'EXIT',
                                                                                         {undef,
                                                                                          [{lager_syslog_backend,
                                                                                            init,
                                                                                            [[{facility,
                                                                                               daemon},
                                                                                              {formatter_config,
                                                                                               [date,
                                                                                                " ",
                                                                                                time,
                                                                                                " ",
                                                                                                color,
                                                                                                "[",
                                                                                                severity,
                                                                                                "] ",
                                                                                                {pid,
                                                                                                 []},
                                                                                                " ",
                                                                                                message,
                                                                                                "\n"]},
                                                                                              {identity,
                                                                                               "rabbitmq"},
                                                                                              {level,
                                                                                               info}]],
                                                                                            []},
                                                                                           {gen_event,
                                                                                            server_add_handler,
                                                                                            4,
                                                                                            [{file,
                                                                                              "gen_event.erl"},
                                                                                             {line,
                                                                                              469}]},
                                                                                           {gen_event,
                                                                                            handle_msg,
                                                                                            6,
                                                                                            [{file,
                                                                                              "gen_event.erl"},
                                                                                             {line,
                                                                                              314}]},
                                                                                           {proc_lib,
                                                                                            init_p_do_apply,
                                                                                            3,
                                                                                            [{file,
                                                                                              "proc_lib.erl"},
                                                                                             {line,
                                                                                              247}]}]}}
2018-03-15 15:26:05.778 [error] <0.127.0> Lager failed to install handler lager_syslog_backend into rabbit_log_upgrade_lager_event, retrying later : {'EXIT',
                                                                                                            {undef,
                                                                                                             [{lager_syslog_backend,
                                                                                                               init,
                                                                                                               [[{facility,
                                                                                                                  daemon},
                                                                                                                 {formatter_config,
                                                                                                                  [date,
                                                                                                                   " ",
                                                                                                                   time,
                                                                                                                   " ",
                                                                                                                   color,
                                                                                                                   "[",
                                                                                                                   severity,
                                                                                                                   "] ",
                                                                                                                   {pid,
                                                                                                                    []},
                                                                                                                   " ",
                                                                                                                   message,
                                                                                                                   "\n"]},
                                                                                                                 {identity,
                                                                                                                  "rabbitmq"},
                                                                                                                 {level,
                                                                                                                  info}]],
                                                                                                               []},
                                                                                                              {gen_event,
                                                                                                               server_add_handler,
                                                                                                               4,
                                                                                                               [{file,
                                                                                                                 "gen_event.erl"},
                                                                                                                {line,
                                                                                                                 469}]},
                                                                                                              {gen_event,
                                                                                                               handle_msg,
                                                                                                               6,
                                                                                                               [{file,
                                                                                                                 "gen_event.erl"},
                                                                                                                {line,
                                                                                                                 314}]},
                                                                                                              {proc_lib,
                                                                                                               init_p_do_apply,
                                                                                                               3,
                                                                                                               [{file,
                                                                                                                 "proc_lib.erl"},
                                                                                                                {line,
                                                                                                                 247}]}]}}

I also tested out enabling the console logging with the config: {log, [{console, [{enabled, true}]}]}, and those are viewable without issue via journalctl -o cat -fu rabbitmq-server.service. My current understanding is that this is specifically an issue only with the lager_syslog_backend.

Happy to provide any other information, this is a very basic RabbitMQ server setup, with a single user, single vhost, in a 3 node cluster.

michaelklishin commented 6 years ago

Lager does not support syslog out of the box and we don't have the consensus about shipping Lager plugins with RabbitMQ.

michaelklishin commented 6 years ago

FTR, the exception says "module lager_syslog_backend is undefined" (undef).

jaredledvina commented 6 years ago

Hey @michaelklishin,

Thanks so much for the quick reply! Would it be worth me PR'ing an update to https://github.com/rabbitmq/rabbitmq-website/blob/live/site/logging.md#logging-to-syslog to explicitly mark that configuration as not supported for 3.7?

michaelklishin commented 6 years ago

Yes, we’d definitely appreciate a doc update. Thank you!

Perhaps putting together an example of Lager + Syslog for 3.7.x would be useful, it definitely can be a small community plugin even if we decide to not include the [Lager] plugin into RabbitMQ core or distribution.

I’m not a Lager expert, so you’ll have to bribe @lukebakken or @hairyhum :)

majormoses commented 6 years ago

Should we not re-open this until we fixup the changelog and documentation about this? I don't think its a good stance to break working systems, not call our the changes, and close the issue before steps are taken to warn users.

michaelklishin commented 6 years ago

@majormoses syslog was never supported out of the box. We didn't break anything.

michaelklishin commented 6 years ago

I edited out all Syslog mentions in the logging guide (which was introduced together with 3.7)

If someone wants to discuss a RabbitMQ plugin that would allow logging to syslog, you are welcome to do it on the mailing list.

majormoses commented 6 years ago

Thanks for the clarification and quick turn around to updating the documentation.