JoaoJandre commented on issue #10578:
URL: https://github.com/apache/cloudstack/issues/10578#issuecomment-2740323342

   > with upgrade to the log4j 2.x 
([#7131](https://github.com/apache/cloudstack/pull/7131)) , the content of all 
API responses are logged.
   > 
   > this issue is caused by massive response of API listApis. `2025-03-18 
14:17:53,683 INFO [c.c.a.ApiServlet] (qtp2038105753-4077:[ctx-c7d0b173, 
ctx-8784ed60]) (logid:d5c7cecd) (userId=2 accountId=2 
sessionId=node0q691iwxlhj07l65hzs2gg3ru2) 15.178 -- GET 
command=listApis&response=json&sessionkey=Sc6JtXZo8btFy6yP7WA9888BXIs 200 
{"listapisresponse":{"count":812,"api":[{"name":"createVPCOffering","description":"Creates
 VPC 
offering","isasync":true,"related":"updateVPCOffering,listVPCOfferings","params":[{"name":"serviceproviderlist","description":"provider
 to service mapping. If not specified, the provider for the service will be 
mapped to the default provider on the physical 
network","type":"map","length":255,"required":false},`
   > 
   > I am not sure if it is configurable. maybe 
[@JoaoJandre](https://github.com/JoaoJandre) can give some advise
   
   Yes, @weizhouapache @ztskycn  this was changed (by mistake) with the #7131 
PR, originally, the API response logs were being written to a specific 
logger/appender/file. #10567 should fix this so that it goes back to what it 
used to be by default. 
   
   One workaround to limit the size of your log lines is to set the `maxLen` 
property on the PaternLayout of the mgmt log appender. It would look something 
like this:
   
   ```
         <RollingFile name="FILE" append="true" 
fileName="/var/log/cloudstack/management/management-server.log" 
filePattern="/var/log/cloudstack/management/management-server.log.%d{yyyy-MM-dd}.gz">
            <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
            <Policies>
               <TimeBasedTriggeringPolicy/>
            </Policies>
            <PatternLayout pattern="%maxLen{%d{DEFAULT} %-5p [%c{1.}] (%t:%x) 
(logid:%X{logcontextid}) %m%ex{filters(${filters})}}{1000}%n"/>
         </RollingFile>
   ```
   
   Using this configuration, each log line would have at most 1000 characters. 
This number should be tweaked so that you can still read important log 
information but those enormous JSON logs are truncated. See 
https://logging.apache.org/log4j/2.x/manual/pattern-layout.html#converter-max-len
 for more information on how to configure your logs.
   
   In any case, is your server going down because of no disk space left? If 
not, I fail to see how the log size would affect this.


-- 
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