Server Task Log - Cleanup old tasks

Hello OD community,

I have been given a sprint task of setting up automation to ensure our OD task log is as small and clean as we deem possible. To do so, I have created a script which makes an API call to see all tasks, determine if they are completed (success or fail, doesn’t matter), see if they are older than 500 days old, then delete if so.

The issue I am now experiencing is the DELETE method isn’t supported for the task items; error 405 returned. I was wondering if there is another way to clean up the tasks or if there even is a supported way to delete old server tasks – NOTE we do have retention policies in place to cleanup deployments and releases. Your documentation and other forum posts seem to primarily describe doing this for cleanup. While this has cleaned up our active projects, it leaves behind “Delete Release X.X.X.XXX” tasks and some of our teams rarely deploy, but need to keep their project, thus the retention policy does not hit their project. We want to be able to delete ANY task from the task log which is older than 500 days.

Please advise; redacted script and output:

od_task_cleanup_script.ps1 (1.1 KB)

Hi Brandon,

Thank you for contacting Octopus Support.

Currently, the only supported way to clean old tasks is via retention policies. I would recommend setting up different lifecycle and channel policies based on the different needs of projects. It may make sense to use a tighter retention policy for the seldom used projects and a looser policy for the high-frequency projects.

I’m sure you’ve seen it, but just in case, here is our documentation for retention policies.

If you have any more questions about this or anything else, don’t hesitate to ask. :slight_smile:


That makes sense and appears to be the case for our deployment tasks. However, there are many server tasks which are not being cleaned up. These tasks seem to be triggered by the retention policy to remove other task logs, but they cannot themselves be cleaned up. Is there a way to clean these administrative tasks, or will the total log endlessly grow as we continue to use the instance throughout the years?

Picture showcasing some sample tasks from 3+ years ago:

Thanks for your prompt attention.
NOTE - we are on version 2019.13.7, but have upgraded a couple times, I do not recall what version we were on when this instance was fresh.

Hi Brandon,

Thank you for getting back to me.

It looks like your examples primarily revolve around tentacles. Let me get with my engineering team to see if they can glean more information about what we can do to clean those up.

I appreciate your patience while I look into this.


Is there any update to this request?

Hi Brandon,

Thanks for following up. I apologize for the wait.

The engineering team has advised me that old task logs relating to tentacle upgrades shouldn’t have a tangible effect on performance or disk space. At this time, retention policies does not cover these tasks, but is on the radar for future improvement.

If you have any additional questions about this or anything else, please let me know.


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.