8

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

iso_9001_
  • 2,655
  • 6
  • 31
  • 47

2 Answers2

5

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 -->
rich
  • 18,987
  • 11
  • 75
  • 101
  • Thank you. The OS is `Ubuntu Server`. I will check the `domain.xml` and try the arguments. – iso_9001_ Nov 07 '15 at 21:51
  • 5
    Prefer using CLI or the web console over changing the XML though. The `rotate-size` and `max-backup-index` are for the `size-rotating-file-handler` not the `periodic-rotating-file-handler`. Also note that these should be going into a log file per server. If not something has been overridden. It's a bad idea to have more than one server writing the same file too. – James R. Perkins Nov 08 '15 at 00:03
5
  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>
    
Bejond
  • 1,188
  • 1
  • 11
  • 18