How i can access to reports older than 7 days?

Hello, community!
Problem:
I’m using Foreman with puppetDB.
And I want to access to reports older than 7 days.
In puppetdb server in database.ini file i has added these options:
report-ttl = 60d
node-purge_ttl = 60d
resource-events-ttl = 60d
node-ttl = 60d
And restarted puppetdb
Then, i has executed these command
foreman-rake reports:expire days=60
And restarted foreman.
But after that then i am open reports for the node, i am still view only reports for last 7 days.

what am I doing wrong?

Expected outcome:
displaying reports for 60 instead of 7 days
Foreman and Proxy versions:
foreman version 2.1.2
puppetdb version 6.12.0
Foreman and Proxy plugin versions:

Distribution and version:
CentOS 8
Other relevant data:

Did you also change the cronjob? If not, this cronjob will delete reports older than 7 days.

1 Like

Thank you for rapid answer, I am checked crontab -l, and did not find any tasks.

also I have run
for user in $(cut -d':' -f1 /etc/passwd); do crontab -u $user -l; done
and this script output “no crontab” for all users.
systemctl status *timer
ouptut only 3 tasks not related to foreman or puppet.

It is located in /etc/cron.d/foreman on my system and contains 30 7 * * * foreman /usr/sbin/foreman-rake reports:expire >>/var/log/foreman/cron.log 2>&1 which uses the default of 7 days.

1 Like

Thanks a lot! I hope the problem is solved.
I am edit the /etc/cron.d/foreman file, I am modified the string
30 7 * * * foreman /usr/sbin/foreman-rake reports:expire >>/var/log/foreman/cron.log 2>&1
to
30 7 * * * foreman /usr/sbin/foreman-rake reports:expire days=90 >>/var/log/foreman/cron.log 2>&1
And will check result in a few days.

1 Like

Note reports can very easily get a lot of DB resources, keep the history as minimal as possible. We are working hard on a new approach that will vastly optimize this.

1 Like

Personally, i use

# Expire old reports
30 7 * * *      foreman    /usr/sbin/foreman-rake reports:expire days=0 status=0  >>/var/log/foreman/cron.log 2>&1
0 8 * * *       foreman    /usr/sbin/foreman-rake reports:expire days=60 >>/var/log/foreman/cron.log 2>&1

this only keeps reports where something was done/changed :wink:

1 Like