Categories
Uncategorized

How to inspect RabbitMQ settings using command-line

Inspect RabbitMQ settings using command-line.

Use Erlang to display RabbitMQ version.

$ sudo rabbitmqctl eval "rabbit_misc:version()."
"3.8.2"

Use Erlang to display OTP release number.

$ sudo rabbitmqctl eval "rabbit_misc:otp_release()."
"22.2"

Use Erlang to display RabbitMQ node name.

$ sudo rabbitmqctl eval 'node().'
rabbit@rabbit

Use Erlang to display RabbitMQ configuration parameters.

$ sudo rabbitmqctl eval 'application:get_all_env(rabbit).'
[{lager_upgrade_file,"/var/log/rabbitmq/rabbit@rabbit_upgrade.log"},
 {quorum_cluster_size,5},
 {max_message_size,134217728},
 {autocluster,[{peer_discovery_backend,rabbit_peer_discovery_classic_config}]},
 {disk_free_limit,50000000},
 {collect_statistics_interval,5000},
 {quorum_commands_soft_limit,256},
 {ssl_allow_poodle_attack,false},
 {channel_operation_timeout,15000},
 {backing_queue_module,rabbit_priority_queue},
 {disk_monitor_failure_retries,10},
 {fhc_read_buffering,false},
 {cluster_nodes,{[],disc}},
 {default_consumer_prefetch,{false,0}},
 {loopback_users,[<<"guest">>]},
 {msg_store_file_size_limit,16777216},
 {enabled_plugins_file,"/etc/rabbitmq/enabled_plugins"},
 {reverse_dns_lookups,false},
 {mnesia_table_loading_retry_limit,10},
 {plugins_expand_dir,"/var/lib/rabbitmq/mnesia/rabbit@rabbit-plugins-expand"},
 {server_properties,[]},
 {ssl_cert_login_from,distinguished_name},
 {background_gc_target_interval,60000},
 {config_entry_decoder,[{passphrase,undefined}]},
 {handshake_timeout,10000},
 {default_vhost,<<"/">>},
 {lager_extra_sinks,[rabbit_log_lager_event,t_log_connection_lager_event,
                     rabbit_log_connection_lager_event,
                     rabbit_log_ldap_lager_event,
                     rabbit_log_mirroring_lager_event,
                     rabbit_log_queue_lager_event,rabbit_log_ra_lager_event,
                     rabbit_log_federation_lager_event,
                     rabbit_log_shovel_lager_event,
                     rabbit_log_upgrade_lager_event]},
 {vm_memory_high_watermark,0.4},
 {lager_default_file,"/var/log/rabbitmq/rabbit@rabbit.log"},
 {queue_explicit_gc_run_operation_threshold,1000},
 {vm_memory_calculation_strategy,rss},
 {mirroring_sync_batch_size,4096},
 {hipe_modules,[rabbit_reader,rabbit_channel,gen_server2,rabbit_exchange,
                rabbit_command_assembler,rabbit_framing_amqp_0_9_1,
                rabbit_basic,rabbit_event,lists,queue,priority_queue,
                rabbit_router,rabbit_trace,rabbit_misc,rabbit_binary_parser,
                rabbit_exchange_type_direct,rabbit_guid,rabbit_net,
                rabbit_amqqueue_process,rabbit_variable_queue,
                rabbit_binary_generator,rabbit_writer,delegate,gb_sets,lqueue,
                sets,orddict,rabbit_amqqueue,rabbit_limiter,gb_trees,
                rabbit_queue_index,rabbit_exchange_decorator,gen,dict,ordsets,
                file_handle_cache,rabbit_msg_store,array,
                rabbit_msg_store_ets_index,rabbit_msg_file,
                rabbit_exchange_type_fanout,rabbit_exchange_type_topic,mnesia,
                mnesia_lib,rpc,mnesia_tm,qlc,sofs,proplists,credit_flow,pmon,
                ssl_connection,tls_connection,ssl_record,tls_record,gen_fsm,
                ssl]},
 {channel_tick_interval,60000},
 {ssl_handshake_timeout,5000},
 {auth_mechanisms,['PLAIN','AMQPLAIN']},
 {hipe_compile,false},
 {channel_max,2047},
 {vhost_restart_strategy,continue},
 {memory_monitor_interval,2500},
 {background_gc_enabled,false},
 {queue_index_max_journal_entries,32768},
 {connection_max,infinity},
 {credit_flow_default_credit,{400,200}},
 {auth_backends,[rabbit_auth_backend_internal]},
 {num_ssl_acceptors,10},
 {password_hashing_module,rabbit_password_hashing_sha256},
 {lager_log_root,"/var/log/rabbitmq"},
 {msg_store_io_batch_size,4096},
 {delegate_count,16},
 {msg_store_index_module,rabbit_msg_store_ets_index},
 {log,[{file,[{file,"/var/log/rabbitmq/rabbit@rabbit.log"}]},
       {categories,[{upgrade,[{file,"/var/log/rabbitmq/rabbit@rabbit_upgrade.log"}]}]}]},
 {default_user,<<"guest">>},
 {frame_max,131072},
 {queue_index_embed_msgs_below,4096},
 {cluster_keepalive_interval,10000},
 {mnesia_table_loading_retry_timeout,30000},
 {ssl_options,[]},
 {ssl_apps,[asn1,crypto,public_key,ssl]},
 {lazy_queue_explicit_gc_run_operation_threshold,1000},
 {feature_flags_file,"/var/lib/rabbitmq/mnesia/rabbit@rabbit-feature_flags"},
 {trace_vhosts,[]},
 {default_pass,<<"guest">>},
 {num_tcp_acceptors,10},
 {disk_monitor_failure_retry_interval,120000},
 {cluster_partition_handling,ignore},
 {ssl_listeners,[]},
 {default_permissions,[<<".*">>,<<".*">>,<<".*">>]},
 {mirroring_flow_control,true},
 {msg_store_credit_disc_bound,{4000,800}},
 {fhc_write_buffering,true},
 {halt_on_upgrade_failure,true},
 {tcp_listen_options,[{backlog,128},
                      {nodelay,true},
                      {linger,{true,0}},
                      {exit_on_close,false}]},
 {vm_memory_high_watermark_paging_ratio,0.5},
 {heartbeat,60},
 {plugins_dir,"/usr/lib/rabbitmq/plugins:/usr/lib/rabbitmq/lib/rabbitmq_server-3.8.2/plugins"},
 {proxy_protocol,false},
 {default_user_tags,[administrator]},
 {tcp_listeners,[5672]},
 {collect_statistics,fine}]

Use Erlang to display RabbitMQ configuration parameters and use JSON output format.

$ sudo rabbitmqctl eval 'application:get_all_env(rabbit).' --formatter json | jq .
{
  "lager_upgrade_file": [
    47,
    118,
    97,
    114,
    47,
    108,
    111,
    103,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    64,
    114,
    97,
    98,
    98,
    105,
    116,
    95,
    117,
    112,
    103,
    114,
    97,
    100,
    101,
    46,
    108,
    111,
    103
  ],
  "quorum_cluster_size": 5,
  "max_message_size": 134217728,
  "autocluster": {
    "peer_discovery_backend": "rabbit_peer_discovery_classic_config"
  },
  "disk_free_limit": 50000000,
  "collect_statistics_interval": 5000,
  "quorum_commands_soft_limit": 256,
  "ssl_allow_poodle_attack": false,
  "channel_operation_timeout": 15000,
  "backing_queue_module": "rabbit_priority_queue",
  "disk_monitor_failure_retries": 10,
  "fhc_read_buffering": false,
  "cluster_nodes": [
    [],
    "disc"
  ],
  "default_consumer_prefetch": [
    false,
    0
  ],
  "loopback_users": [
    "guest"
  ],
  "msg_store_file_size_limit": 16777216,
  "enabled_plugins_file": [
    47,
    101,
    116,
    99,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113,
    47,
    101,
    110,
    97,
    98,
    108,
    101,
    100,
    95,
    112,
    108,
    117,
    103,
    105,
    110,
    115
  ],
  "reverse_dns_lookups": false,
  "mnesia_table_loading_retry_limit": 10,
  "plugins_expand_dir": [
    47,
    118,
    97,
    114,
    47,
    108,
    105,
    98,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113,
    47,
    109,
    110,
    101,
    115,
    105,
    97,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    64,
    114,
    97,
    98,
    98,
    105,
    116,
    45,
    112,
    108,
    117,
    103,
    105,
    110,
    115,
    45,
    101,
    120,
    112,
    97,
    110,
    100
  ],
  "server_properties": [],
  "ssl_cert_login_from": "distinguished_name",
  "background_gc_target_interval": 60000,
  "config_entry_decoder": {
    "passphrase": "undefined"
  },
  "handshake_timeout": 10000,
  "default_vhost": "/",
  "lager_extra_sinks": [
    "rabbit_log_lager_event",
    "rabbit_log_channel_lager_event",
    "rabbit_log_connection_lager_event",
    "rabbit_log_ldap_lager_event",
    "rabbit_log_mirroring_lager_event",
    "rabbit_log_queue_lager_event",
    "rabbit_log_ra_lager_event",
    "rabbit_log_federation_lager_event",
    "rabbit_log_shovel_lager_event",
    "rabbit_log_upgrade_lager_event"
  ],
  "vm_memory_high_watermark": 0.4,
  "lager_default_file": [
    47,
    118,
    97,
    114,
    47,
    108,
    111,
    103,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    64,
    114,
    97,
    98,
    98,
    105,
    116,
    46,
    108,
    111,
    103
  ],
  "queue_explicit_gc_run_operation_threshold": 1000,
  "vm_memory_calculation_strategy": "rss",
  "mirroring_sync_batch_size": 4096,
  "hipe_modules": [
    "rabbit_reader",
    "rabbit_channel",
    "gen_server2",
    "rabbit_exchange",
    "rabbit_command_assembler",
    "rabbit_framing_amqp_0_9_1",
    "rabbit_basic",
    "rabbit_event",
    "lists",
    "queue",
    "priority_queue",
    "rabbit_router",
    "rabbit_trace",
    "rabbit_misc",
    "rabbit_binary_parser",
    "rabbit_exchange_type_direct",
    "rabbit_guid",
    "rabbit_net",
    "rabbit_amqqueue_process",
    "rabbit_variable_queue",
    "rabbit_binary_generator",
    "rabbit_writer",
    "delegate",
    "gb_sets",
    "lqueue",
    "sets",
    "orddict",
    "rabbit_amqqueue",
    "rabbit_limiter",
    "gb_trees",
    "rabbit_queue_index",
    "rabbit_exchange_decorator",
    "gen",
    "dict",
    "ordsets",
    "file_handle_cache",
    "rabbit_msg_store",
    "array",
    "rabbit_msg_store_ets_index",
    "rabbit_msg_file",
    "rabbit_exchange_type_fanout",
    "rabbit_exchange_type_topic",
    "mnesia",
    "mnesia_lib",
    "rpc",
    "mnesia_tm",
    "qlc",
    "sofs",
    "proplists",
    "credit_flow",
    "pmon",
    "ssl_connection",
    "tls_connection",
    "ssl_record",
    "tls_record",
    "gen_fsm",
    "ssl"
  ],
  "channel_tick_interval": 60000,
  "ssl_handshake_timeout": 5000,
  "auth_mechanisms": [
    "PLAIN",
    "AMQPLAIN"
  ],
  "hipe_compile": false,
  "channel_max": 2047,
  "vhost_restart_strategy": "continue",
  "memory_monitor_interval": 2500,
  "background_gc_enabled": false,
  "queue_index_max_journal_entries": 32768,
  "connection_max": "infinity",
  "credit_flow_default_credit": [
    400,
    200
  ],
  "auth_backends": [
    "rabbit_auth_backend_internal"
  ],
  "num_ssl_acceptors": 10,
  "password_hashing_module": "rabbit_password_hashing_sha256",
  "lager_log_root": [
    47,
    118,
    97,
    114,
    47,
    108,
    111,
    103,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113
  ],
  "msg_store_io_batch_size": 4096,
  "delegate_count": 16,
  "msg_store_index_module": "rabbit_msg_store_ets_index",
  "log": {
    "file": {
      "file": [
        47,
        118,
        97,
        114,
        47,
        108,
        111,
        103,
        47,
        114,
        97,
        98,
        98,
        105,
        116,
        109,
        113,
        47,
        114,
        97,
        98,
        98,
        105,
        116,
        64,
        114,
        97,
        98,
        98,
        105,
        116,
        46,
        108,
        111,
        103
      ]
    },
    "categories": {
      "upgrade": {
        "file": [
          47,
          118,
          97,
          114,
          47,
          108,
          111,
          103,
          47,
          114,
          97,
          98,
          98,
          105,
          116,
          109,
          113,
          47,
          114,
          97,
          98,
          98,
          105,
          116,
          64,
          114,
          97,
          98,
          98,
          105,
          116,
          95,
          117,
          112,
          103,
          114,
          97,
          100,
          101,
          46,
          108,
          111,
          103
        ]
      }
    }
  },
  "default_user": "guest",
  "frame_max": 131072,
  "queue_index_embed_msgs_below": 4096,
  "cluster_keepalive_interval": 10000,
  "mnesia_table_loading_retry_timeout": 30000,
  "ssl_options": [],
  "ssl_apps": [
    "asn1",
    "crypto",
    "public_key",
    "ssl"
  ],
  "lazy_queue_explicit_gc_run_operation_threshold": 1000,
  "feature_flags_file": [
    47,
    118,
    97,
    114,
    47,
    108,
    105,
    98,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113,
    47,
    109,
    110,
    101,
    115,
    105,
    97,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    64,
    114,
    97,
    98,
    98,
    105,
    116,
    45,
    102,
    101,
    97,
    116,
    117,
    114,
    101,
    95,
    102,
    108,
    97,
    103,
    115
  ],
  "trace_vhosts": [],
  "default_pass": "guest",
  "num_tcp_acceptors": 10,
  "disk_monitor_failure_retry_interval": 120000,
  "cluster_partition_handling": "ignore",
  "ssl_listeners": [],
  "default_permissions": [
    ".*",
    ".*",
    ".*"
  ],
  "mirroring_flow_control": true,
  "msg_store_credit_disc_bound": [
    4000,
    800
  ],
  "fhc_write_buffering": true,
  "halt_on_upgrade_failure": true,
  "tcp_listen_options": {
    "backlog": 128,
    "nodelay": true,
    "linger": [
      true,
      0
    ],
    "exit_on_close": false
  },
  "vm_memory_high_watermark_paging_ratio": 0.5,
  "heartbeat": 60,
  "plugins_dir": [
    47,
    117,
    115,
    114,
    47,
    108,
    105,
    98,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113,
    47,
    112,
    108,
    117,
    103,
    105,
    110,
    115,
    58,
    47,
    117,
    115,
    114,
    47,
    108,
    105,
    98,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113,
    47,
    108,
    105,
    98,
    47,
    114,
    97,
    98,
    98,
    105,
    116,
    109,
    113,
    95,
    115,
    101,
    114,
    118,
    101,
    114,
    45,
    51,
    46,
    56,
    46,
    50,
    47,
    112,
    108,
    117,
    103,
    105,
    110,
    115
  ],
  "proxy_protocol": false,
  "default_user_tags": [
    "administrator"
  ],
  "tcp_listeners": [
    5672
  ],
  "collect_statistics": "fine"
}

Use Erlang to display RabbitMQ log configuration parameter.

$ sudo rabbitmqctl eval 'application:get_env(rabbit, log).'
{ok,[{file,[{file,"/var/log/rabbitmq/rabbit@rabbit.log"}]},
     {categories,[{upgrade,[{file,"/var/log/rabbitmq/rabbit@rabbit_upgrade.log"}]}]}]}

Use Erlang to display RabbitMQ loopback_users configuration parameter.

$ sudo rabbitmqctl eval 'application:get_env(rabbit, loopback_users).'
{ok,[<<"guest">>]}

Use Erlang to get RabbitMQ configuration parameters and extract log file.

$ sudo rabbitmqctl eval 'application:get_all_env(rabbit).' --formatter=json | jq --raw-output '.log.file.file | implode'
/var/log/rabbitmq/rabbit@rabbit.log

These arrays are not so scary when you know how to convert an array of code point numbers to a string using implode function.