The `foreman-rake audits:expire` command with or without the `days=` argument does most of the necessary cleanup of audit records as expected, but it never touches or deletes any of the audit records related to any templates.
It's hardcoded to behave like this in https://github.com/theforeman/foreman/blob/develop/lib/tasks/audits.rake#L60-L64
Reproducible?
Yes
Steps to reproduce :
1. On a satellite that has been running for quite some time, execute "foreman-rake audits:expire --trace"
2. Check the output of this query in satellite's postgres:
select id,auditable_id,auditable_type,action from audits;
Actual Behavior :
Any of the audits related to the auditable_type ReportTemplate, Ptable, ProvisioningTemplate, and JobTemplate are not touched or cleaned up at all.
Expected Behavior:
- If the ignore list here in https://github.com/theforeman/foreman/blob/develop/lib/tasks/audits.rake#L60-L64 was created due to a specific reason, then please document it in the appropriate section of the product documentation. e.g. https://docs.redhat.com/en/documentation/red_hat_satellite/6.17/html/administering_red_hat_satellite/maintaining-satellite-server_admin#deleting-audit-records-manually_admin
- Secondly, depending on the arguments passed with audit expire rake, make sure that it's able to clean up those audits related to the auditable_type ReportTemplate, Ptable, ProvisioningTemplate and JobTemplate , where the template no longer exist any more.