Rabbitmq trace

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску


RabbitMQ log messages

To debug rabbitmq and related services it is possible to use trace plugin. It is installed by default but not enabled.
More details: https://github.com/rabbitmq/rabbitmq-tracing


  • check plugins list
    rabbitmq-plugins list
  • enable plugin (e.g. on controller)
    rabbitmq-plugins enable rabbitmq_tracing
  • configure valid credentials and log directory in rabbitmq config file /etc/rabbitmq/rabbitmq.config
...
  {rabbitmq_tracing, [
    {directory, "/var/log/rabbitmq/"},
    {username,  "nova"},
    {password, "nova_password" }
   ]}

Please replace nova_password with valid password, usually this password is listed in rabbitmq.config above.

  • Restart rabbitmq
  • Start trace
    rabbitmqctl trace_on
  • Configure trace:
    curl -i -u nova:nova_password -H "content-type:application/json" -XPUT \ http://localhost:15672/api/traces/%2f/my-trace \ -d'{"format":"text","pattern":"#", "max_payload_bytes":10000}'

Please pay your attention, it is necessary to change nova_password and set valid port (in example port is 15672 but you need to check port with netsnat tool)

  • Check log file: /var/log/rabbitmq/my-trace.log
  • Message example:
================================================================================
2016-01-28 14:15:45:373: Message published

Node:         rabbit@node-6
Connection:   192.168.0.2:57900 -> 192.168.0.2:5673
Virtual host: /
User:         nova
Channel:      2
Exchange:     keystone
Routing keys: [<<"lma_notifications.info">>]
Routed queues: [<<"lma_notifications.info">>]
Properties:   [{<<"priority">>,signedint,0},
               {<<"delivery_mode">>,signedint,2},
               {<<"headers">>,table,[]},
               {<<"content_encoding">>,longstr,<<"utf-8">>},
               {<<"content_type">>,longstr,<<"application/json">>}]
Payload:
{"priority": "INFO", "_unique_id": "07ef65a029f9499e96e0235ff9ab7e67", "event_type": "identity.authenticate", "timestamp": "2016-01-28 14:15:45.370633", "publisher_id": "identity.node-6.domain.tld", "payload": {"typeURI": "http://schemas.dmtf.org/cloud/audit/1.0/event", "ini
tiator": {"typeURI": "service/security/account/user", "host": {"agent": "python-keystoneclient", "address": "192.168.0.7"}, "id": "56aa47e7bf964ce4a13456f055739c29"}, "target": {"typeURI": "service/security/account/user", "id": "openstack:617333d0-0ef7-4e3f-8602-42afda4d8711
"}, "observer": {"typeURI": "service/security", "id": "openstack:0844c4f0-f38e-43d9-8709-a7299d09d2fc"}, "eventType": "activity", "eventTime": "2016-01-28T14:15:45.370419+0000", "action": "authenticate", "outcome": "success", "id": "openstack:c5f9471c-f09c-414f-8f30-14a7c8c1
deae"}, "message_id": "5fb3dcc0-98dd-46d4-8e99-24e82962325c"}

================================================================================