3 Replies Latest reply on Feb 15, 2019 11:53 AM by James Perkins

    Log compression on rotation

    Marco Rossi Newbie

      I've found this feature mentioned here : [LOGMGR-30] Support automatic log file compression in FileHandler (for compressing all files in real time) and PeriodicR… 

       

      But I'm not able to set this configuration, so the question is:

       

      1) there is an option to configure this compression on PeriodicRotationFile from admin console?

      2) and how to activate same option from jboss-cli ?

       

      My wildfly version is 12.0

        • 1. Re: Log compression on rotation
          James Perkins Master

          You configure it by setting the suffix to either .gz or .zip. For example with the default daily rotating file handler the follow CLI command would compress the file when it's rotated.

          /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=suffix, value=".yyyy-MM-dd.zip")

           

          --

          James R. Perkins

          • 2. Re: Log compression on rotation
            Vladimir Kravchenko Newbie

            I have tried the jboss-cli command with WildFly 15.0.1.Final, but it has been rejected:

             

            [standalone@embedded /] /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=suffix, value=".yyyy-MM-dd.zip")

            {

                "outcome" => "failed",

                "failure-description" => "WFLYLOG0041: The suffix (.yyyy-MM-dd.zip) is invalid. A suffix must be a valid date format.",

                "rolled-back" => true

            }

             

            [standalone@embedded /] /core-service=module-loading:list-resource-loader-paths(module=org.jboss.logmanager)

            {

                "outcome" => "success",

                "result" => [

                    "wildfly-home/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.5.Final.jar",

                    "wildfly-home/modules/system/layers/base/org/jboss/logmanager/main/lib"

                ]

            }

             

            What could be the reason?

             

            /Vladimir

            • 3. Re: Log compression on rotation
              James Perkins Master

              Well that's embarrassing. It looks like a bug. I've filed https://issues.jboss.org/browse/WFCORE-4331. Not ideal, but as a workaround you could do:

              /subsystem=logging/custom-handler=FILE:add(module=org.jboss.logmanager, class="org".jboss.logmanager.handlers.PeriodicRotatingFileHandler, named-formatter=PATTERN, properties={autoFlush=true, append=true, fileName=${jboss.server.log.dir}/server.log, suffix=".yyyy-MM-dd.zip"})

               

              --

              James R. Perkins