Selectively run Activity Stream on certain projects / templates

Hi All,

I have a couple of jobs, sourced from one project, that runs often and generates about 200K lines of logs every hours, and growing the postgres database about 100-200GB per month. I also want have the a clean up job that runs weekly but is set to keep the activity streams for 3 months due to business needs.

Does anyone have advice on how to perhaps create a policy for certain jobs (based template ID or project ID) to have a different retention period than the rest? Poking through the code-base i see

  1. ActivityStream model exposes timestamp as a string objective

https://github.com/ansible/awx/blob/devel/awx/main/models/activity_stream.py (90-99)

  1. deletion happen here:
    https://github.com/ansible/awx/blob/devel/awx/main/management/commands/cleanup_activitystream.py

if asobj.timestamp >= self.cutoff:

pks_to_delete.add(asobj.pk)

Can we modify the code to do something like this:

if asobj.timestamp >= self.cutoff:

pks_to_delete.add(asobj.pk)

elsif asobj.timestamp >= self.new_cutoff and asobj.job == 13:

pks_to_delete.add(asobj.pk)

Appreciate the guidance!