Install Erlang OTO 21 (10.0.1) with default selections in the wizard, without making any changes in wizard.
Install RabbitMQ 3.7.7 with default selections in the wizard, without making any changes in wizard.
During the installation process, I have not created any environment variables etc.
On completion of Erlang & RabbitMQ installation, RabbitMQ service is up & by default, the log is being created under the path \AppData\Roaming\RabbitMQ\log
.
Currently we can see too many ‘INFO’ entries in this log & the log is getting filled too soon which will unnecessarily eat up the disk space at a pace of almost 500 MB per day, leading to other problems over a period of few days.
We are interested that only ‘Error’ are logged in the log file & that ‘Info’ shall not be logged.
From Run -> services.msc, stop the RabbitMQ service.
I am able to find the rabbitmq.config.example
file under the folder \AppData\Roaming\RabbitMQ
In the %% Lager controls logging.
section at the bottom of the file, I make changes in the example file to change the logging level from ‘info’ to ‘error’ as follows:
%% Lager controls logging.
%% See https://github.com/basho/lager for more documentation
{lager, [
%%
%% Log directory, taken from the RABBITMQ_LOG_BASE env variable by default.
%% {log_root, "/var/log/rabbitmq"},
%%
%% All log messages go to the default "sink" configured with
%% the `handlers` parameter. By default, it has a single
%% lager_file_backend handler writing messages to "$nodename.log"
%% (ie. the value of $RABBIT_LOGS).
%% {handlers, [
%% {lager_file_backend, [{file, "rabbit.log"},
%% {level, error},
%% {date, ""},
%% {size, 0}]}
%% ]},
%%
%% Extra sinks are used in RabbitMQ to categorize messages. By
%% default, those extra sinks are configured to forward messages
%% to the default sink (see above). "rabbit_log_lager_event"
%% is the default category where all RabbitMQ messages without
%% a category go. Messages in the "channel" category go to the
%% "rabbit_channel_lager_event" Lager extra sink, and so on.
%% {extra_sinks, [
%% {rabbit_log_lager_event, [{handlers, [
%% {lager_forwarder_backend,
%% [lager_event, error]}]}]},
%% {rabbit_channel_lager_event, [{handlers, [
%% {lager_forwarder_backend,
%% [lager_event, error]}]}]},
%% {rabbit_conection_lager_event, [{handlers, [
%% {lager_forwarder_backend,
%% [lager_event, error]}]}]},
%% {rabbit_mirroring_lager_event, [{handlers, [
%% {lager_forwarder_backend,
%% [lager_event, error]}]}]}
%% ]}
]}
Install Erlang OTO 21 (10.0.1) with default selections in the wizard, without making any changes in wizard.
Rename the file RabbitMQ.config.example to rabbitmq.conf
Install RabbitMQ 3.7.7 with default selections in the wizard, without making any changes in wizard.
Open RabbitMQ command prompt, & execute the command rabbitmq-plugins
enable rabbitmq_management
During the installation process, I have not created any environment variables etc.
From Run -> services.msc, start the RabbitMQ service.
On completion of Erlang & RabbitMQ installation, RabbitMQ service is up & by default, the log is being created under the path \AppData\Roaming\RabbitMQ\log
.
Currently we can see too many ‘INFO’ entries in this log & the log is getting filled too soon which will unnecessarily eat up the disk space at a pace of almost 500 MB per day, leading to other problems over a period of few days.
We are interested that only ‘Error’ are logged in the log file & that ‘Info’ shall not be logged.
Restart the server.
From Run -> services.msc, stop the RabbitMQ service.
After this though logging stops happening, not because the above changes worked, but because RabbitMQ stops working.
The log file mentions the path of config files as follows:
config file(s) : c:/Users/MANPRE~1.SIN/AppData/Roaming/RabbitMQ/advanced.config
: c:/Users/MANPRE~1.SIN/AppData/Roaming/RabbitMQ/rabbitmq.conf
As I am not able to find the rabbitmq.conf file under the folder \AppData\Roaming\RabbitMQ
, I would have rather expected the entry in log for config as 'rabbitmq.conf not found', but no such entry is there in the log.
- However, I am able to find
rabbitmq.config.example
file under the same path.
I uncomment the code & remove the comments from the file and save the file as below:
'''
[
{rabbit, [{tcp_listeners, [5672]},
{tcp_listeners, [{"127.0.0.1", 5672},
{"::1", 5672}]},
{ssl_listeners, [5671]},
{num_tcp_acceptors, 10},
{num_ssl_acceptors, 1},
{handshake_timeout, 10000},
{reverse_dns_lookups, false},
{loopback_users, [<<"guest">>]},
{loopback_users, []},
{ssl_options, [{cacertfile, "/path/to/testca/cacert.pem"},
{certfile, "/path/to/server/cert.pem"},
{keyfile, "/path/to/server/key.pem"},
{verify, verify_peer},
{fail_if_no_peer_cert, false}]},
{auth_mechanisms, ['PLAIN', 'AMQPLAIN']},
{auth_backends, [rabbit_auth_backend_internal]},
{auth_mechanisms, ['EXTERNAL']},
{auth_backends, [rabbit_auth_backend_ldap]},
{ssl_cert_login_from, distinguished_name},
{ssl_handshake_timeout, 5000},
{ssl_allow_poodle_attack, false},
{password_hashing_module, rabbit_password_hashing_sha256},
{config_entry_decoder, [{passphrase, <<"mypassphrase">>}]}
{config_entry_decoder, [{passphrase, {file, "/path/to/passphrase/file"}}]}
{config_entry_decoder, [{passphrase, prompt}]}
{config_entry_decoder, [{cipher, aes_cbc256},
{hash, sha512},
{iterations, 1000}]}
{default_vhost, <<"/">>},
{default_user, <<"guest">>},
{default_pass, <<"guest">>},
{default_permissions, [<<".">>, <<".">>, <<".*">>]},
{default_user_tags, [administrator]},
{heartbeat, 60},
{frame_max, 131072},
{initial_frame_max, 4096},
{channel_max, 0},
{connection_max, infinity},
{tcp_listen_options, [{backlog, 128},
{nodelay, true},
{exit_on_close, false}]},
{vm_memory_high_watermark, 0.4},
{vm_memory_high_watermark, {absolute, 1073741824}},
{vm_memory_high_watermark, {absolute, "1024M"}},
{vm_memory_high_watermark_paging_ratio, 0.5},
{vm_memory_calculation_strategy, rss},
{memory_monitor_interval, 2500},
{total_memory_available_override_value, "5000MB"},
{disk_free_limit, 50000000},
{disk_free_limit, "50MB"},
{disk_free_limit, "50000kB"},
{disk_free_limit, "2GB"},
{disk_free_limit, {mem_relative, 2.0}},
{queue_master_locator, <<"client-local">>},
{mirroring_sync_batch_size, 4096},
{mirroring_flow_control, true},
{server_properties, []},
{cluster_partition_handling, ignore},
{mirroring_sync_batch_size, 4096},
{cluster_nodes, {['[email protected]'], disc}},
{cluster_keepalive_interval, 10000},
{collect_statistics, none},
{collect_statistics_interval, 5000},
{trace_vhosts, []},
{hipe_compile, false},
{delegate_count, 16},
{mnesia_table_loading_retry_limit, 10},
{mnesia_table_loading_retry_timeout, 30000},
{queue_index_embed_msgs_below, 4096},
{queue_index_max_journal_entries, 32768},
{msg_store_credit_disc_bound, {4000, 800}},
{msg_store_io_batch_size, 4096},
{credit_flow_default_credit, {400, 200}},
{channel_operation_timeout, 15000},
{queue_explicit_gc_run_operation_threshold, 1000},
{lazy_queue_explicit_gc_run_operation_threshold, 1000},
{disk_monitor_failure_retries, 10},
{disk_monitor_failure_retry_interval, 120000},
{background_gc_enabled, false},
{background_gc_target_interval, 60000},
{msg_store_file_size_limit, 16777216},
{fhc_write_buffering, true},
{fhc_read_buffering, false}
]},
{kernel, [{net_ticktime, 60}]},
{rabbitmq_management, [ {load_definitions, "/path/to/exported/definitions.json"},
{http_log_dir, "/path/to/rabbitmq/logs/http"},
{listener, [{port, 12345},
{ip, "127.0.0.1"},
{ssl, true},
{ssl_opts, [{cacertfile, "/path/to/cacert.pem"},
{certfile, "/path/to/cert.pem"},
{keyfile, "/path/to/key.pem"}]}]},
{rates_mode, basic},
{sample_retention_policies,
[{global, [{60, 5}, {3600, 60}, {86400, 1200}]},
{basic, [{60, 5}, {3600, 60}]},
{detailed, [{10, 5}]}]}
]},
{rabbitmq_shovel,
[{shovels,
[{my_first_shovel,
[{sources, [{brokers, ["amqp://user:[email protected]/my_vhost"]},{declarations, []}]},
{destinations, [{broker, "amqp://"},{declarations, []}]},
{queue, <<"your-queue-name-goes-here">>},
{prefetch_count, 10},
{ack_mode, on_confirm},
{publish_fields, [{exchange, <<"my_exchange">>},
{routing_key, <<"from_shovel">>}]},
{publish_properties, [{delivery_mode, 2}]},
{reconnect_delay, 2.5}
]}
]}
{defaults, [{prefetch_count, 0},
{ack_mode, on_confirm},
{publish_fields, []},
{publish_properties, [{delivery_mode, 2}]},
{reconnect_delay, 2.5}]}
]},
{rabbitmq_stomp,
[
{tcp_listeners, [{"127.0.0.1", 61613},
{"::1", 61613}]},
{ssl_listeners, [61614]},
{num_tcp_acceptors, 10},
{num_ssl_acceptors, 1},
{ssl_cert_login, true},
{default_user,
[{login, "guest"},
{passcode, "guest"}]},
{implicit_connect, true},
{proxy_protocol, false}
]
},
{rabbitmq_mqtt,
[
{default_user, <<"guest">>},
{default_pass, <<"guest">>},
{allow_anonymous, true},
{vhost, <<"/">>},
{exchange, <<"amq.topic">>},
{subscription_ttl, 1800000},
{prefetch, 10},
{tcp_listeners, [1883]},
{ssl_listeners, []},
{num_tcp_acceptors, 10},
{num_ssl_acceptors, 1},
{tcp_listen_options, [
{backlog, 128},
{linger, {true, 0}},
{exit_on_close, false}
]},
{proxy_protocol, false}
]},
{rabbitmq_amqp1_0,
[
{default_user, "guest"},
{protocol_strict_mode, false}
]},
{rabbitmq_auth_backend_ldap,
[
{servers, ["your-server-name-goes-here"]},
{use_ssl, false},
{port, 389},
{timeout, infinity},
{log, false},
{user_dn_pattern, "cn=${username},ou=People,dc=example,dc=com"},
{dn_lookup_attribute, "userPrincipalName"},
{dn_lookup_base, "DC=gopivotal,DC=com"},
{other_bind, as_user},
{vhost_access_query, {in_group,"ou=${vhost}- users,ou=vhosts,dc=example,dc=com"}},
{resource_access_query, {constant, true}},
{tag_queries, []}
]},
{lager, [
{log_root, "/var/log/rabbitmq"},
{handlers, [
{lager_file_backend, [{file, "rabbit.log"},
{level, info},
{date, ""},
{size, 0}]}
]},
{extra_sinks, [ {rabbit_log_lager_event,[{handlers, [{lager_forwarder_backend,[lager_event, info]}]}]},
{rabbit_channel_lager_event, [{handlers,[{lager_forwarder_backend,[lager_event, info]}]}]},
{rabbit_conection_lager_event, [{handlers, [{lager_forwarder_backend,[lager_event, info]}]}]},
{rabbit_mirroring_lager_event, [{handlers, [{lager_forwarder_backend,[lager_event, info]}]}]}
]}
]}
].
'''
- Rename the file RabbitMQ.config.example to
rabbitmq.conf
- Open RabbitMQ command prompt, & execute the command
rabbitmq-plugins
enable rabbitmq_management
- From Run -> services.msc, start the RabbitMQ service.
- Restart the server.
- After this though logging stops happening, not because the above changes worked, but because RabbitMQ stops working.
I will appreciate if you are able to point out where am I going wrong, or could guide me to be able to log ‘error’ infind the log.conf file instead of logging ‘info’.