I am not sure whether you can auto delete files based on time lines of 4 days, the
<periodic-rotating-file-handler>
does not have the provision to do so.
However since your requirement is to free the disk space you can achieve that by using your config file (standalone or domain.xml).
By default the config file logging setting comes with periodic-rotating-file setting which looks like:
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
Please change it to size-rotating-file-handler and define the log size(rotate-size) that you would want to maintain and the number of files(max-backup-index) by doing this you have fixed the size of your log directory and always rotate within the given size allocations.
<size-rotating-file-handler name="FILE" autoflush="true" >
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<append value="true"/>
<rotate-size value="10000K"/>
<max-backup-index value="3"/>
</size-rotating-file-handler>
Note that suffix does not work with <size-rotating-file-handler>
For more info