Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3111

Filter which stops logging if disk space left is lower than a configurable threshold

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Filters
    • None

    Description

      This is a common scenario where in case a host's disk is getting full we may prefer to stop secondary responsibilities of a system like logging, to prevent the system from completely crashing.

      I am proposing to add a DiskSpaceCheckingFilter which would take in a minimumDiskSpaceFree percentage threshold and would filter out events if the diskspace is full. We could use the Java File.getUsableSpace and File.getTotalSpace to calculate the disk free percentage, and since these operations are costly they could be run on a separate thread and keep updating a Atomic variable which stores the thresholds, which would be queried on every event.

      Caveats of this Filter (an additional thread, performance impact due to checking a atomic variable etc) can be called out and left up to users discretion to use or not.

      Will raise a PR if this proposal is accepted.

      Attachments

        Activity

          People

            Unassigned Unassigned
            adwsingh Adwait Kumar Singh
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: