WSO2 Api Manager log Http request in log mediator

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 00:24:16

问题


Is there a way to include the http request remote host in the log mediator being used for a specific api?

Having followed the instructions, i can log the soap message, but i have no info regarding the caller of the service.

I currently use the following sequence definition:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="WSO2AM--Ext--In">
    <log level="full">
        <property name="TRACE" value="Gunet Mediation Extension"/>
    </log>
</sequence>

And the result i get when having a call is the following:

INFO - LogMediator To: /SmartSearch/1, WSAction: urn:SearchStudentStatus, SOAPAction: urn:SearchStudentStatus, MessageID: urn:uuid:36f9a5cd-c8cb-4e1e-97a6-f3ebd3303589, Direction: request, TRACE = Gunet Mediation Extension, Envelope: <?xml version='1.0' encoding='utf-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><SearchStudentStatus xmlns="gunet.gr"><SSN>12312312312</SSN><institution>aueb</institution></SearchStudentStatus></S:Body></S:Envelope>

I would like to have information about the remote host that made the specific call. Is that possible, using the log mediator, or should i use a combination of log4j configs?

Thanks!


回答1:


You can get the remote IP which call the API using following property mediator.

<log level="full">
   <property name="Actual Remote Address" expression="get-property('axis2','REMOTE_ADDR')"/>
</log>


来源:https://stackoverflow.com/questions/36719129/wso2-api-manager-log-http-request-in-log-mediator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!