简体   繁体   中英

WSO2 Identity Server 5.0.0 Logging X-Forwarded-For Header

I'm just wondering if it's possible to log the X-Forwarded-For Header in the log files?

It's a different WSO2 product but i have tried the following but it didn't appear to work: https://docs.wso2.com/display/ESB480/Access+Logs

Has anyone managed to do this?

Cheers

James

I changed the pattern attribute and made the application restart , so the client IP came to be logged in.

File: /idp/wso2is-4.5.0/repository/conf/tomcat/catalina-server.xml

...
<Engine name="Catalina" defaultHost="localhost">
    <Realm className="org.wso2.carbon.tomcat.ext.realms.CarbonTomcatRealm"/>
    <Host name="localhost" unpackWARs="true" deployOnStartup="false" autoDeploy="false" appBase="${carbon.home}/repository/deployment/server/webapps/">
        <Valve className="org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve"/>
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="${carbon.home}/repository/logs"
            prefix="http_access_" suffix=".log"
            pattern='%{X-Forwarded-For}i - %h %l %u %t "%r" %s %b %D ms' />
        <Valve className="org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve" threshold="600"/>
        <Valve className="org.wso2.carbon.tomcat.ext.valves.CompositeValve"/>
    </Host>
</Engine>
...

Complementing : the client's IP is logged only in the "http_access_ ${date} .log" file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM