You can create a monitoring profile to configure your message flows to emit monitoring events.
You can use XPath 1.0 expressions to configure a monitoring event.