You are viewing the documentation of TeamCity 10.x and 2017.x, which is not the most recently released version of TeamCity.
View this page in the latest documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.


Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Clean-up in TeamCity is a feature allowing automatic deletion of data belonging to old builds.

Since TeamCity 9.0, projectProject-related clean-up settings are configured in the Project Settings (not in the Server Administration | Clean-up Settings section like in previous versions).

The general clean-up configuration is available in the server Administration | Clean-up Settings.


The server settings are configured on the Administration | Server Administration | Clean-up Settings.

Since TeamCity 9.0, the The build history clean-up is run as a background process, which means that now there is no server maintenance down-time.
(warning) If you use the HSQL database, there is a short period of server unavailability when the HSQL database is being compacted.

Depending on the amount of data to clean up, the process may take significant time, during which the server might be less performant. Therefore, it is recommended to schedule clean-up to run during off-peak hours. By default, TeamCity will start cleaning up daily at 3.00 AM. It is also possible to run it manually.

You can also specify the time limit for the clean-up process. In case not all the data is purged within the time-frame specified, the remaining data will be removed during the next clean-up process.

With clean-up enabled, TeamCity will keep the server audit records for a year (365 days) by default.

Manual Clean-up Launch

The Previous clean-up  section of the server clean-up settings enables you to:


Clean-up rules are configured per project and define when and what data to clean. Different rules can be assigned to a project and templates or build configurations within this project.

To manage the rules, use the Project-Settings | Clean-up Rules The Clean-up Rules page allows assigning different rules to a project, and the templates or build configurations within this project.

The following inheritance rules apply:


When both conditions are specified, only the builds which must be cleaned according to all rules will be actually removed: TeamCity finds the oldest build to preserve according to each of the the rules and then cleans all builds older than the oldest one of the two found.


  • Artifact patterns. The artifacts matching the specified pattern will be included in/excluded from the clean-up. Use newline-delimited rules following Ant-like pattern. Example: to  
    - to clean-up artifacts with 'file' as a part of the name, use the following syntax: +:**/file*.*. To  
    - to exclude *.jar artifacts with 'file' as a part of the name from clean-up, use -:**/file*.jar.



TeamCity always preserves builds which are used as snapshot dependencies in other builds. These builds are not deleted from builds history by the clean-up procedure until dependent builds are deleted. Artifacts of these builds can be deleted based on the option below.
TeamCity can optionally preserve builds and their artifacts which are used in other builds by artifact dependencies.