So, for larger foreman installations, it seems certain table(s) are not covered by the normal maintenance rake tasks. I can clear out reports no problem, as well as sessions, using built-in rake tasks.
However, these tables seem to just grow, and grow, and grow. On our install (11,000 agents checking in every 30 minutes) they are each millions or tens of millions of records, and id rather have some of it “age out” but they seem to go back infinitely:
messages
sources
logs
audits
“How” Can i safely trim these? Can I?
Looking at messages specifically, it looks like report run details…
Some have timestamps similar to: 2017-11-30 22:12:15.414902385 -0500
I find this odd, because I use the foreman rake task to delete reports older than 30 days. 11/30 was 3 months ago? And the report it was a part of is long gone…Would anything built in (rake task) clean these up? Am I OK to truncate this table occasionally? Any downsides to truncating it?
Looking at sources specifically, I’m not positive what i’m looking at, but i see a ton of values which are puppet file resources, and digests which are hashes. Would anything built in (rake task) clean these up? Am I OK to truncate this table occasionally? Any downsides to truncating it?
Looking at logs specifically, This looks like the association (foreign key/referential integrity) table between reports, sources, audits, in the format:
id, source_id, message_id, report_id, level_id, created_at, updated_at, result
‘10701’, ‘1094’, ‘1121’, ‘458181’, ‘3’, ‘2015-09-17 17:42:24’, ‘2015-09-17 17:42:24’, NULL
Specifically looking at the above record from my table, its from September 2017. But again, we clear all reports after 30 days - the report ID referenced no longer exists in foreman (i searched for it).
Looking at “audits” it seems to be all audit records visible within foreman. However, this too, goes back to the beginning of our install 3+ years ago, and is millions and millions of records. I’d like to only keep audits for, say, 3 months, or 6 months, or 1 year, but this doesn’t look configurable. Is there any downside to truncating the audits table? I know from doing upgrades that many tasks seem to do selects against it - particularly for the db:seed tasks
Thanks for anyone who can help me understand how to properly maintain these tables, I’m hoping to keep my DB size under control, as with these tables it just seems to grow indefinitely.
~Jason