This documentation is for WSO2 API Manager 2.0.0. View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

Message Tracing is an identification of each message flow in each transaction which goes through the gateway. WSO2 API Manager provides the facility to do message tracing by installing the Message Tracer feature developed for WSO2 Products. It is used to logging, auditing and debugging message content and it’s direction.

Message Tracer is a part of carbon-analytics. From API Manager 2.1.0 onwards, Message Tracer feature is build into API Manager.

Configuring Message Tracer

Follow the below steps to configure Message Tracer in API Manager.

  1. Log into Managemet Console (https://localhost:9443/carbon).
  2. Navigate to Configure > Message Tracing in Configure Tab to open the Message Tracing Configuration.
  3. Select Enable Message Tracing and click Update to enable Message Tracking.
  4. Select following options as well if you wish to get the message tracing in detail.
Dump Message ContentEnable Message tracing for the Content of the Message as well.
Enable LoggingEnable Logging into available logging handler to log the tracing message.
Enable Analytics Event PublishingPublish tracing events to API Manager Analytics

Tracing Events Publishing to API Manager Analytics

You can trace the messages of event publishing to API Manager Analytics with Message Tracing feature following below steps.

Before you begin,

Make sure you have configured API Manager Analytics. Refer Configuring APIM Analytics to configure Analytics.

  1. Select Enable Analytics Event Publishing in Message Tracer Configuration and click update.

    Once you have saved the changes, APIM will generate stream definition in <APIIM_HOM>/repository/deployment/server/eventstreams/DAS_MESSAGE_TRACE_1.0.0.json.

  2. Copy the DAS_MESSAGE_TRACE_1.0.0.json file to <APIM_ANALITICS_HOME>/repository/deployment/server/eventstreams directory to deploy the same definition in API Manager Analytics.

  3. Login to API Manager Analytics (https://localhost:9444/carbon) and navigate to Main > Event > Streams.

    You will be able to see the deployed stream under event streams. Now we need to persist the event stream to save data into a table.

  4. Click Edit in the stream definition DAS_MESSAGE_TRACE:1.0.0 and open the edit view.
  5. Click Next[Persist Event] at the bottom of the edit view.
  6. In the next page select Persist Event Stream and select all attribute checkboxes to perist and click on Save Event Stream button.

    You should configure an Event receiver to point thid Event stream.
  7. Go to Main -> Event -> Receivers in API Manager Analytics and and click on Add Event Receiver.
  8. Add following details and click on Add Event Receiver.

    Event Receiver Namemessage_trace_receiver
    Input Event Adoptor Typewso2event
    Is events duplicated in clusterfalse
    Event StreamDAS_MESSAGE_TRACE:1.0.0
    Message formatwso2event

    Next, a publisher need to be configured in order to publish events to API Manager Analytics. To do that,

  9. Go to Main > Event > Publishers in API Manager Analytics and click Add Event Publisher.

  10. In Create a New Event Publisher page, add the following details and click Add Event Publisher.

    Event Publisher Namemessage_tracer_publisher
    Event SourceDAS_MESSAGE_TRACE:1.0.0
    Stream Attributes

    Keep default values

    Output Event Adaptor Typewso2event
    Receiver URLtcp://localhost:7612
    User Nameadmin
    Publishing modenon-blocking
    Message Formatwso2event


After enabling Message tracing, Dump Message Contnet and Logging, you can see the log Message similar to this from API Console for events like API invocation etc.

[2017-01-11 11:43:08,039]  INFO - HandlerUtils Massage Info: Transaction id=632470820207822377292  Message direction=IN  Server name=  Timestamp=1515651188039  Service name=__SynapseService  Operation Name=mediate
[2017-01-11 11:43:08,040]  INFO - HandlerUtils Massage Info: Transaction id=632470820207822377292  Message direction=OUT  Server name=  Timestamp=1515651188040  Service name=__SynapseService  Operation Name=mediate
[2017-01-11 11:43:08,047]  INFO - HandlerUtils Massage Info: Transaction id=632471565977965101628  Message direction=IN  Server name=  Timestamp=1515651188047  Service name=__SynapseService  Operation Name=mediate
[2017-01-11 11:43:08,060]  INFO - HandlerUtils Massage Info: Transaction id=632471565977965101628  Message direction=OUT  Server name=  Timestamp=1515651188058  Service name=__SynapseService  Operation Name=mediate

If you have enabled Analytics event Publishing,

  1. Login to WSO2 API Manager Analytics (https://localhost:9444/carbon)
  2. Navigate to Main > Data Explorer.
  3. Select the table DAS_MESSAGE_TRACE and click Search.
    You can see the event data traced in WSO2 Analytics Data Explorer as below.

  • No labels