Message Tracing is an identification of refers to the process of identifying each message flow in each transaction which goes of each of the transactions that go through the gateway. Gateway. You can do message tracing on WSO2 API Manager provides the facility to do message tracing by by installing the Message Tracer feature that has been specifically developed for WSO2 Products. It is used to products. You can use the Message Tracer to derive logging, auditing, and debugging related information with regard to message content and it’s direction.
Message Tracer is a part of carbon-analytics and this feature is built into WSO2 API Manager.
...
Follow the below steps to configure Message Tracer in API Manager.
- Log into Managemet Management Console (https://localhost:9443/carbon).
- Navigate to Configure > Message Tracing in Configure Tab to open the Message Tracing Configuration.
- Select Enable Message Tracing and click Update to enable Message Tracking.
- Select following options as well if you wish to get the message tracing in detail.
...
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.
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.
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.
- Click Edit in the stream definition DAS_MESSAGE_TRACE:1.0.0 and open the edit view.
- Click Next[Persist Event] at the bottom of the edit view.
- 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 to the Event stream. - Go to Main -> Event -> Receivers in API Manager Analytics and and click on Add Event Receiver.
Add following details and click on Add Event Receiver.
property Value Event Receiver Name message_trace_receiver Input Event Adoptor Adapter Type wso2event Is events duplicated in cluster false Event Stream DAS_MESSAGE_TRACE:1.0.0 Message format wso2event Next, a publisher need to be configured in order to publish events to API Manager Analytics. To do that,
Go to Main > Event > Publishers in API Manager Analytics and click Add Event Publisher.
In Create a New Event Publisher page, add the following details and click Add Event Publisher.
Property Value Event Publisher Name message_tracer_publisher Event Source DAS_MESSAGE_TRACE:1.0.0 Stream Attributes Note Keep default values
Output Event Adaptor Adapter Type wso2event Receiver URL tcp://localhost:7612 User Name admin Password admin Protocol thrift Publishing mode non-blocking Message Format wso2event
...
After enabling Message tracing, Dump Message Contnet Content, and Logging, you can see the log Message similar to this from API Console for events like API invocation etc.
...