MID Server File Cleaner

  • Release version: Yokohama
  • Updated July 20, 2026
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of MID Server File Cleaner

    The MID Server File Cleaner is a monitoring thread within the MID Server that automatically deletes old files and empty folders from specific directories to manage storage size and maintain MID Server performance. It targets files last accessed more than 30 days ago and runs at startup and every 24 hours thereafter. The cleaner can also be triggered by restarting the MID Server service.

    Show full answer Show less

    Cleaned Folders and Purpose

    • \agent\import and \agent\export: Used by the Export Set feature. Files here are expected to be moved by custom customer implementations to avoid buildup.
    • \agent\work\monitors\ECCSender\outputerror: Stores ECC input payloads that failed insertion since the San Diego release.
    • \agent\work\monitors\ECCSender\outputoversize: Contains payloads rejected for exceeding the max payload size (default 20,000,000 bytes) since Eureka/Fuji releases.
    • \agent\logs: Specifically JFR dump files introduced in the Utah release.

    Logging and Monitoring

    The MID Server agent log records when the File Cleaner monitor starts and stops with the MID Server. Detailed scan activity for each folder is logged only when debug logging is enabled via the parameter mid.log.level=debug. However, individual file or folder deletions are not logged.

    Disabling the MID Server File Cleaner

    The file cleaner can be completely disabled by setting the configuration parameter mid.filecleaner.disabled=true. This can be done:

    • On the MID Server form under the "Configuration Parameters" related list by adding mid.filecleaner.disabled with the value true.
    • Directly in the MID Server’s config.xml file by adding:
      <parameter name="mid.filecleaner.disabled" value="true"/>

    By default, the cleaner is enabled (false if the parameter is not present).

    Practical Considerations for ServiceNow Customers

    • The file cleaner helps ensure MID Server stability by preventing excessive disk usage from outdated files.
    • Customers using Export Sets should implement custom processes to move files from the \agent\export folder promptly to avoid unintended deletion.
    • Enabling debug logging for the cleaner can assist in troubleshooting or monitoring cleanup operations.
    • Disabling the file cleaner is possible but should be done cautiously to avoid disk space and performance issues.

    A monitor thread runs in the MID Server to clean up old files, to keep the size and quantity of files within the install folder manageable, and to prevent performance issues with the MID Servers.

    Files and empty folders within the following folders may be deleted by this MID File Cleaner. Files last accessed more than 30 days ago are deleted.

    It runs on startup, and then every 24 hours after that. You can force the File Cleaner to run by restarting the MID Server service.

    Folders/files cleaned:

    • \agent\import
    • \agent\export - Used by the Export Set feature.
    • \agent\work\monitors\ECCSender\output_error - Used since San Diego for ECC input payloads that cannot be inserted for any reason (see PRB1521761/KB0995569).
    • \agent\work\monitors\ECCSender\output_oversize - Used since Eureka/Fuji for saving copies of payloads that are not sent to the instance because they are larger than the limit set by mid.eccq.max_payload_size, which defaults to 20000000 bytes (see PRB598334)
    • \agent\logs - Specifically JFR Dumps (Utah release)

    Logging

    The MID Server agent log shows this monitor starting and shutting down with the MID Server.

    2022-10-21T13:08:58.330+0200 INFO (MIDServer) [Main:265] Initializing MID Server 
    2022-10-21T13:10:36.527+0200 INFO (StartupSequencer) [Monitors:307] Enabling monitor: FileCleanerMonitor
    ... 
    2022-10-24T09:29:35.193+0200 INFO (MIDServer) [MIDServerState:160] MID Server stopping 
    2022-10-24T09:29:38.591+0200 INFO (MIDServer) [Instance:928] interrupting thread FileCleanerMonitor.21600

    To see exactly when it runs, enable debug with parameter mid.log.level=debug.

    2022-11-17T02:49:13.201-0800 DEBUG (FileCleanerMonitor.21600) [AFileCleaner:103] Scanning directory to delete files: C:\...\agent\import
    2022-11-17T02:49:13.201-0800 DEBUG (FileCleanerMonitor.21600) [AFileCleaner:103] Scanning directory to delete files: C:\...\agent\export
    2022-11-17T02:49:13.201-0800 DEBUG (FileCleanerMonitor.21600) [AFileCleaner:103] Scanning directory to delete files: C:\...\agent\work\monitors\ECCSender\output_error
    2022-11-17T02:49:13.201-0800 DEBUG (FileCleanerMonitor.21600) [AFileCleaner:103] Scanning directory to delete files: C:\...\agent\work\monitors\ECCSender\output_oversize
    2022-11-17T02:49:13.201-0800 DEBUG (FileCleanerMonitor.21600) [AFileCleaner:103] Scanning directory to delete files: C:\...\agent\logs

    There is no logging for individual file/folder deletes.

    Disabling the MID File Cleaner

    Export Sets write files to the MID Server agent\export folders. The idea is then that a custom implementation on the customer side takes those files and moves them elsewhere, so that these files only need to remain in the MID Server application's install directory for a short time.

    The MID File Cleaner can be disabled completely for all folders, by adding the MID Server Configuration Parameter mid.file_cleaner.disabled=true. When the parameter is not present, which is the out-of-box state, it defaults to false, and the file cleaner runs.

    On the MID Server form, click New on the "Configuration Parameters" related list, select mid.file_cleaner.disabled, and enter the value "true".

    This can also be manually added to the config.xml file: <parameter name="mid.file_cleaner.disabled" value="true"/>. See MID Server parameters for more information.