How to compress rotated access log in JBoss EAP 7/8
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
Issue
- I need to compress a rotated access log file to save disk space.
Resolution
To rotate JBoss EAP access log, add the suffix attribute .gz or .zip.
-
Using JBoss CLI (Recommended):
/subsystem=logging/periodic-size-rotating-file-handler=ACCESS_LOG:write-attribute(name=suffix,value=".yy-MM-dd.gz") -
Changing the XML manually:
<periodic-size-rotating-file-handler name="ACCESS_LOG" autoflush="true"> <formatter> <named-formatter name="ACCESS_LOG_FORMATTER"/> </formatter> <file relative-to="jboss.server.log.dir" path="access_log.log"/> <rotate-size value="500m"/> <max-backup-index value="3"/> <suffix value=".yy-MM-dd.gz"/> <<== here <append value="true"/> </periodic-size-rotating-file-handler>
Root Cause
This is a new feature implemented since JBoss EAP 7.3. It is not possible to compress the logs before that version.
SBR
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.