Copilot commented on code in PR #11854:
URL: https://github.com/apache/cloudstack/pull/11854#discussion_r2685067271


##########
client/src/main/java/org/apache/cloudstack/ACSRequestLog.java:
##########
@@ -51,9 +53,8 @@ public void log(Request request, Response response) {
             StringBuilder sb = buffers.get();
             sb.setLength(0);
 
-            sb.append(request.getHttpChannel().getEndPoint()
-                            .getRemoteAddress().getAddress()
-                            .getHostAddress())
+            InetAddress remoteAddress = ApiServlet.getClientAddress(request);
+            sb.append(remoteAddress)

Review Comment:
   The log format has changed by appending the InetAddress object directly 
instead of calling getHostAddress(). This results in IP addresses being logged 
with a leading "/" (e.g., "/192.168.1.1" instead of "192.168.1.1") because 
InetAddress.toString() returns the format "hostname/ipaddress" or "/ipaddress". 
This format change could break existing log parsing tools. Consider calling 
getHostAddress() on the InetAddress object to maintain the previous log format.
   ```suggestion
               sb.append(remoteAddress != null ? remoteAddress.getHostAddress() 
: "-")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to