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

Only start syslog application if it is required #1728

Merged
merged 1 commit into from Oct 12, 2018

Conversation

lukebakken
Copy link
Collaborator

@lukebakken lukebakken commented Oct 10, 2018

Fixes #1718

Test using the following rabbitmq.config file:

%% {rfc5424, udp, [{ip, {127,0,0,1}}]}
%% {rfc5424, udp}
[
    {syslog, [
        {dest_port, 5140},
        {dest_host, "127.0.0.1"},
        {protocol,
            {rfc5424, udp, [{ip, {192,168,1,5}}]}
        }
    ]},
    {rabbit, [
        {log, [
            {syslog, [
                {level, info},
                {enabled, true}
            ]},                                                                                                                                                                                                                                                                 
            {console, [                                                                                                                                                                                                                                                         
                {level, info},                                                                                                                                                                                                                                                  
                {enabled, true}                                                                                                                                                                                                                                                 
            ]}                                                                                                                                                                                                                                                                  
        ]},                                                                                                                                                                                                                                                                     
        {loopback_users,[]}                                                                                                                                                                                                                                                     
    ]}                                                                                                                                                                                                                                                                          
].

You can experiment by using different values in protocol, or by leaving that term out completely. If you leave out ip, 127.0.0.1 will be used. Use netstat to confirm:

netstat -pan | fgrep beam

You will see a line beginning with udp and it should be bound to the local address you expect.

If you leave out all syslog configuration, you will not see beam.smp listening on any udp ports.

@lukebakken lukebakken force-pushed the rabbitmq-server-1718-syslog-localhost branch from dda132a to 0186a91 Compare October 10, 2018 20:43
@lukebakken lukebakken changed the title WIP: Only start syslog application if it is required Only start syslog application if it is required Oct 10, 2018
Copy link
Member

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work as advertised w.r.t. UDP listeners.

However, I get extra standard output (error?) log messages from error logger with this PR. On master:

(rabbit@warp10)1>
  ##  ##
  ##  ##      RabbitMQ x.y.z.g1be4734. Copyright (C) 2007-2018 Pivotal Software, Inc.
  ##########  Licensed under the MPL.  See http://www.rabbitmq.com/
  ######  ##
  ##########  Logs: /var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T/rabbitmq-test-instances/rabbit/log/rabbit.log
                    /var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T/rabbitmq-test-instances/rabbit/log/rabbit_upgrade.log

              Starting broker...
 completed with 0 plugins.

On rabbitmq-server-1718-syslog-localhost:

(rabbit@warp10)1>
  ##  ##
  ##  ##      RabbitMQ x.y.z.gc44722a. Copyright (C) 2007-2018 Pivotal Software, Inc.
  ##########  Licensed under the MPL.  See http://www.rabbitmq.com/
  ######  ##
  ##########  Logs: /var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T/rabbitmq-test-instances/rabbit/log/rabbit.log
                    /var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T/rabbitmq-test-instances/rabbit/log/rabbit_upgrade.log

              Starting broker...
=INFO REPORT==== 12-Oct-2018::06:29:49.425017 ===
Limiting to approx 7068 file handles (6359 sockets)

=INFO REPORT==== 12-Oct-2018::06:29:49.545610 ===
started TCP listener on [::]:5672

Note that the above happens without any configuration file (e.g. gmake run-broker RABBITMQ_CONFIG_FILE=/tmp/non-existent), so nothing instructs RabbitMQ to log to console.

From rabbitmq environment:

{log,
    [{file,
         [{file,
              "/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T/rabbitmq-test-instances/rabbit/log/rabbit.log"}]},
     {categories,
         [{upgrade,
              [{file,
                   "/var/folders/gp/53t98z011678vk9rkcb_s6ph0000gn/T/rabbitmq-test-instances/rabbit/log/rabbit_upgrade.log"}]}]}]}

@michaelklishin
Copy link
Member

@lukebakken I merged master into this branch so cherry-picking the merge commit to v3.7.x might introduce a 3.8.0-specific change 😓. Sorry. Cherry picking individual commits should be safe.

@lukebakken
Copy link
Collaborator Author

@michaelklishin that output is probably due to lager starting at a different time than prior to this change. Let me see if I can figure it out.

@lukebakken lukebakken force-pushed the rabbitmq-server-1718-syslog-localhost branch from c44722a to 0186a91 Compare October 12, 2018 14:35
@lukebakken
Copy link
Collaborator Author

@michaelklishin FYI I undid the merge commit you mention in this comment

Fix up syslog protocol options to set ip to localhost if unset

Ensure default handler for OTP 21.1+ logger is removed
@lukebakken lukebakken force-pushed the rabbitmq-server-1718-syslog-localhost branch from 64c7c7a to 2d9b8ce Compare October 12, 2018 16:07
@lukebakken
Copy link
Collaborator Author

@michaelklishin ready for round #2. This issue pointed me in the right direction: erlang-lager/lager#481

@michaelklishin michaelklishin merged commit d481842 into master Oct 12, 2018
@michaelklishin michaelklishin deleted the rabbitmq-server-1718-syslog-localhost branch October 12, 2018 17:29
lukebakken pushed a commit that referenced this pull request Oct 12, 2018
…calhost

Only start syslog application if it is required

(cherry picked from commit d481842)
lukebakken added a commit that referenced this pull request Oct 15, 2018
lukebakken added a commit that referenced this pull request Oct 15, 2018
michaelklishin pushed a commit that referenced this pull request Oct 16, 2018
Related to #1718 and #1728

(cherry picked from commit d8b7e91)
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

Successfully merging this pull request may close these issues.

None yet

2 participants