Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-4531

Limit logfile output by default

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 2.31.2
    • None
    • Broker
    • None

    Description

      The logging config does not limit the amount of rolled-over logfiles that are stored, causing a minor resource leak. The system will (eventually) run out of disk space without manual intervention.

      The relevant config in etc/log4j2.properties currently looks like this:

      # Log file appender
      appender.log_file.type = RollingFile
      appender.log_file.name = log_file
      appender.log_file.fileName = ${sys:artemis.instance}/log/artemis.log
      appender.log_file.filePattern = ${sys:artemis.instance}/log/artemis.log.%d{yyyy-MM-dd}
      appender.log_file.layout.type = PatternLayout
      appender.log_file.layout.pattern = %d %-5level [%logger] %msg%n
      appender.log_file.policies.type = Policies
      appender.log_file.policies.cron.type = CronTriggeringPolicy
      appender.log_file.policies.cron.schedule = 0 0 0 * * ?
      appender.log_file.policies.cron.evaluateOnStartup = true
      
      # Audit log file appender
      appender.audit_log_file.type = RollingFile
      appender.audit_log_file.name = audit_log_file
      appender.audit_log_file.fileName = ${sys:artemis.instance}/log/audit.log
      appender.audit_log_file.filePattern = ${sys:artemis.instance}/log/audit.log.%d{yyyy-MM-dd}
      appender.audit_log_file.layout.type = PatternLayout
      appender.audit_log_file.layout.pattern = %d [AUDIT](%t) %msg%n
      appender.audit_log_file.policies.type = Policies
      appender.audit_log_file.policies.cron.type = CronTriggeringPolicy
      appender.audit_log_file.policies.cron.schedule = 0 0 0 * * ?
      appender.audit_log_file.policies.cron.evaluateOnStartup = true

      This results in a new log file every day if there is any logging output. These files are never deleted and keep accumulating.

      After setting a limit of 5 files it looks like this:

      # Log file appender
      appender.log_file.type = RollingFile
      appender.log_file.name = log_file
      appender.log_file.fileName = ${sys:artemis.instance}/log/artemis.log
      appender.log_file.filePattern = ${sys:artemis.instance}/log/artemis.log.%d{yyyy-MM-dd}
      appender.log_file.layout.type = PatternLayout
      appender.log_file.layout.pattern = %d %-5level [%logger] %msg%n
      appender.log_file.policies.type = Policies
      appender.log_file.policies.cron.type = CronTriggeringPolicy
      appender.log_file.policies.cron.schedule = 0 0 0 * * ?
      appender.log_file.policies.cron.evaluateOnStartup = true
      appender.log_file.strategy.type = DefaultRolloverStrategy
      appender.log_file.strategy.max = 5
      
      # Audit log file appender
      appender.audit_log_file.type = RollingFile
      appender.audit_log_file.name = audit_log_file
      appender.audit_log_file.fileName = ${sys:artemis.instance}/log/audit.log
      appender.audit_log_file.filePattern = ${sys:artemis.instance}/log/audit.log.%d{yyyy-MM-dd}
      appender.audit_log_file.layout.type = PatternLayout
      appender.audit_log_file.layout.pattern = %d [AUDIT](%t) %msg%n
      appender.audit_log_file.policies.type = Policies
      appender.audit_log_file.policies.cron.type = CronTriggeringPolicy
      appender.audit_log_file.policies.cron.schedule = 0 0 0 * * ?
      appender.audit_log_file.policies.cron.evaluateOnStartup = true
      appender.audit_log_file.strategy.type = DefaultRolloverStrategy
      appender.audit_log_file.strategy.max = 5 

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cathodion Geert Schuring
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m