How to control log files' size?

Hello,

I've been checking the disk taken by our logs (in my TC 8 installation) and it's way too much. My disk usage tab is reporting projects with over 3500 MB of space taken by log files.

I've read the online documentation but I'm not getting much from it on how to control the size of a log file produced by a build. For one thing all the log preset configurations are based on file size and for another it does not say which of the presets is the default.
https://confluence.jetbrains.com/display/TCD8/TeamCity+Server+Logs

What I would like to do is making the build's log file just produced another artifact so I can control it with the clean up policy. This is plan A.
If that would not be possible, plan B would be to change the logging configuration for a customized preset. For this I need to know how do I apply a log preset configuration to build logs only?

Thanks in advance.
Ivan

6 comments
Comment actions Permalink

Hi Ivan,

The link that you posted points to doc section that describes TeamCity server logs. These logs are produced by TeamCity itself and can be controlled by presets.
While on the Disk Usage page you see the size of Build logs - https://confluence.jetbrains.com/display/TCD8/Build+Log. It is actually the console output of your builds. To minimize the size of logs you can tune build scripts not to print too much into the output. To delete build logs please use clean-up rules with at least History level.

0
Comment actions Permalink

Thanks for your answer Alina.

I actually would like my logs the way they are, because when things go wrong in CI these are the resources that save me.

For the clean up configuration I do have one:

Clean artifacts older than the 200th successful build; artifact patterns: +:**/*
Other items are kept forever

Do not prevent dependency artifacts cleanup

but, still when I check for the disk usage I get this misleading report

Builds on disk: 1762, with artifacts: 205
Average artifacts: 23.52 MB, logs: 1.49 MB
Pinned: 3 builds, 87.87 MB occupied on disk
Top 5 builds with above-average disk usage
  • build #4789: 47.88 MB (+279%)
  • build #4790: 44.82 MB (+267%)
  • build #4784: 44.60 MB (+266%)
  • build #4785: 43.96 MB (+264%)
  • build #4782: 43.96 MB (+264%)

are the logs saved as part of the "other items" that are kept forever?
0
Comment actions Permalink

Yes, build logs are kept forever with your clean-up settings. To delete build logs please use History level: all the build data is deleted except for builds statistics values that are visible in the statistics charts.

0
Comment actions Permalink

I son't have the option you mentioned.
In the "Build History Clean up -> Configure clean up rules" all I get too choose from is Default policy and Custom policy. The latter offers you the chance to set either the days I wanto to keep the data or the number of successful builds.
Same options format is available for Clean history and Clean everything.
Might be the version 8.0.4?

0
Comment actions Permalink

To delete build logs you should go to Administration > Build History Clean-Up > Configure clean-up rules > Edit, configure Custom policy on History level (for example the same as you use for artifacts: older than the 200th successful build). By Default policy on History level build logs and all the build data are kept forever.
Clean-up rules are configured the same way for all 8.x versions.
For more details please read http://confluence.jetbrains.com/display/TCD8/Clean-Up.

0
Comment actions Permalink

Thanks a lot. I'm all set.
This piece of information was key

The following clean-up levels are available:

  • Artifacts (all other data including build logs is preserved. Hidden Artifacts are also preserved);
  • History (all the build data is deleted except for builds statistics values that are visible in the statistics charts);
  • Everything (no build data remains in TeamCity).
    Each level includes the one(s) listed above it.
0

Please sign in to leave a comment.