@@ -537,7 +537,30 @@ compressed and archived in the same directory.
537537
538538Over time, the logs can fill up the entire disk space. To avoid this, you can
539539update the log4j-cloud.xml file to change the log file rollover and retention
540- policy. You can checkout some configuration recipes from the log4j2 documentation
540+ policy. You can change the rollover policy to `SizeBasedTriggeringPolicy `
541+ and set the maximum size of the log file. You can also set the maximum number
542+ of archived log files to keep.
543+
544+ For example, to change the rollover policy for `management-server.log ` to
545+ `SizeBasedTriggeringPolicy ` and set the maximum size of the log file to
546+ 100MB and keep the maximum of 15 archived log files, you can update the
547+ `log4j-cloud.xml ` file as follows:
548+
549+ .. code-block :: diff
550+
551+ - <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">
552+ + <RollingFile name="FILE" append="true" fileName="/var/log/cloudstack/management/management-server.log" filePattern="/var/log/cloudstack/management/management-server.log.%i.gz">
553+ <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/>
554+ + <DefaultRolloverStrategy max="15"/>
555+ <Policies>
556+ - <TimeBasedTriggeringPolicy/>
557+ + <SizeBasedTriggeringPolicy size="100MB"/>
558+ </Policies>
559+ <PatternLayout pattern="%d{DEFAULT} %-5p [%c{1.}] (%t:%x) %m%ex%n"/>
560+ </RollingFile>
561+
562+
563+ You can also checkout some configuration recipes from the log4j2 documentation
541564`here <https://logging.apache.org/log4j/2.x/manual/appenders/rolling-file.html#recipes >`_.
542565
543566Stopping and Restarting the Management Server
0 commit comments