Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the max size of the Wildfly server log

We have Wildfly running on Domain mode in our production system. There are around 10 web servers and there is only on log file for all 10 servers. The log file is located under /var/log/wildfly/wildfly.log file. The last time I checked, the files was around 5 GB. My problems are:

  1. Is there any way to separate the server logs so that each server has its own log file?
  2. Is there any way to set the log file to max size limit to prevent over-growing?
  3. Is there any way to delete the log file and start over? Logs before 2 days is useless for me so most of the data in the log file is redundant.

Regard

like image 930
iso_9001_ Avatar asked Nov 07 '15 18:11

iso_9001_


2 Answers

For (1) I'm not sure - is this OS installed? I don't have that file but I just extract the tarball.

For (2) and (3) I think it's a case of looking in domain/configuration/domain.xml or standalone/configuration/standalone.xml for the appropriate ("default"?) periodic-rotating-file-handler and adding, say:

<rotate-size value="20k"/> <!-- Limit on size of file -->
<max-backup-index value="1"/> <!-- Number of log files to keep -->
like image 140
rich Avatar answered Sep 20 '22 12:09

rich


  1. create size-rotating-file-handler

        <size-rotating-file-handler name="FILE_SIZE">
            <level name="DEBUG"/>
            <file relative-to="jboss.server.log.dir" path="server.log"/>
            <rotate-size value="1m"/> <!-- the size, could be 100k, 10m etc-->
            <max-backup-index value="5"/> <!-- backup index, default is 1, please set it to a large number -->
            <append value="true"/>
        </size-rotating-file-handler>
    
  2. use the handler created

        <root-logger>
            <level name="INFO"/>
            <handlers>
                <handler name="CONSOLE"/>
                <handler name="FILE"/>
                <handler name="FILE_SIZE"/> <!-- this is what you need to add -->
            </handlers>
        </root-logger>
    
like image 24
Bejond Avatar answered Sep 18 '22 12:09

Bejond