Logfiles shows load balancer IP address instead of browse IP

Hi Team, In log files, we are getting the load balancer IP address for a multi-node environment. We want to the client browser(end user machine) IP address in the log files.

I have analyzed the prlogging.xml file, In the below appender, I want to add the end user machine IP rather than load balancer IP.

Does anyone know how to add enduser IP address in logfile instead of load balancer IP.

<appender name="PEGA" class="com.pega.pegarules.priv.util.DailySizeRollingFileAppenderPega">

<param name="FileNamePattern" value="'${pega.log.location}/PegaRULES.log.'yyyy-MM-dd"/>

<param name="MaxFileSize" value="50MB" />

<layout class="com.pega.apache.log4j.PatternLayout">

<param name="ConversionPattern" value="%d [%20.20t] [%10.10X{pegathread}] [%20.20X{tenantid}] [%20.20X{app}] (%30.30c{3}) %-5p %X{stack} %X{userid} - %m%n"/>



***Edited by Moderator Marissa to update platform capability tags****


Keep up to date on this post and subscribe to comments

October 2, 2018 - 6:37am


In my opinion it can be done only on LB level, as Pega software recieves a request directly from Load Balancer and only that IP address is logged.

October 2, 2018 - 7:24am

Thanks for the quick response @Jakub.

We are getting the Client IP in our HTTP request headers.  Please go through the below post once for me.

This below java code will log the browser IP address. Is there any possibility to refer this in prlogging file.

  1. javax.servlet.http.HttpServletRequest request = (javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject("pxHTTPServletRequest");
  2. /* Debug only, comment out when done testing */
  3. oLog.infoForced("Incoming headers for login:");
  4. java.util.Enumeration e = request.getHeaderNames();
  5. String header = null;
  6. while (e.hasMoreElements()) {
  7. header = (String) e.nextElement();
  8. oLog.infoForced(header + ": " + request.getHeader(header));
  9. }


August 14, 2019 - 5:18am

Hi Sai,

Did you find any answer for this query?

August 14, 2019 - 7:29am

Ideally you should use x-forwarded-* headers without having to write any java code. I don't recall the exact Pega version we implemented this. What is your Pega version? Try to turn on debug log for "LogHttpRequest" to the details (assuming your version is recent enough).

August 14, 2019 - 10:03pm