Logging Service Invocation Metadata to a CSV File
Using the StatisticsCSVInterceptor, Membrane Monitor and Router can log data about service calls into a file. The fields will be separated by semicolon (;), so that you can import the data into Excel.
Each entry in the log file will contain:
- HTTP status code
- Request time
- The rule that processed the request
- HTTP method used
- Request path as specified by rfc2616
- Client (see rule key)
- Server, the request target
- Content-Type header of the request
- Content-Length headers of the request
- Content-Type header of the response
- Content-Length headers of the response
- Request/response cycle duration
ConfigurationInterceptors can be defined in the monitor-beans.xml or in the proxies.xml file. When you define them in the monitor-beans.xml they can be registered with the transport or referenced from the proxies.xml file. Interceptors that are registerd with the transport are called for every request, while interceptors that are referenced or defined by a serviceProxy or proxy element only apply to requests that target that proxy.
Per proxy logging is configured in a proxy.xml file. Add a statisticsCSV element to a proxy or serviceProxy.
<membrane> <serviceProxy name="predic8.com" port="2000"> <statisticsCSV file="log.csv" /> <target host="membrane-soa.org" port="80" /> </serviceProxy> </membrane>
Take also a look at the example located in the examples/logging-csv directory of your membrane distribution.
Global logging is configured in a monitor-beans.xml file. Add a statisticsCSV element to the transport.
<transport> <interceptors> <ruleMatching /> <dispatching /> <statisticsCSV fileName="log.csv" /> </interceptors> </transport>