Performance Copilot (PCP) data retention?

Latest response

According to this: https://access.redhat.com/solutions/2209361

PCP retention should be in
/etc/cron.d/pcp-pmlogger

This appears not to be a file included in the latest version:

```
Installed Packages
Name : pcp
Arch : x86_64
Version : 4.3.2
Release : 2.el7
Size : 3.7 M
Repo : installed
From repo : rhel-7-server-rpms

rpm -ql pcp | grep cron

/var/lib/pcp/config/pmie/crontab.docker
```

How can I adjust retention in pcp 4.3.2?

Thank you

Responses

I filed a bugzilla to see what happens: https://bugzilla.redhat.com/show_bug.cgi?id=1769083

PCP has switched to using systemd(1) timers since pcp-4.3.2, replacing the old cron based mechanism. The log retention and compression options are now tuned by editing the file /etc/sysconfig/pmlogger_timers and changing the PMLOGGER_DAILY_PARAMS variable. See pmlogger_daily(1) man page, in particular the options affecting log retention time (-k or --discard). and other compression options.

Jul 2021, PCP Version

pcp-5.2.5-4.el8.x86_64

The man page for pmlogger_daily says that you can set environment variable '$PCP_CULLAFTER' to the number of days, but looking at the actual 'pmlogger_daily' script, I do not see reference to this environment variable, so I don't see how it can work?

There are several ways to do this. The pmlogger_daily script evals /etc/sysconfig/pmlogger_timers, which has the effect of setting the variables assigned in that file. In this case you would want to tweak $PMLOGGER_DAILY_PARAMS with the -k option, see pmlogger_daily(1) . That would affect all configured pmloggers on the local machine. For finer control however, set the $PCP_CULLAFTER variable in the control file, see /etc/pcp/pmlogger/control.d/local (that's for the primary logger). Uncomment the line

$PCP_COMPRESSAFTER=3 and set it to the desired number of days. Note the leading $ is required in the variable assignment (this is what the script searches for). This will set that variable for all pmloggers configured in that control file (on a virgin install that's the local primary pmlogger only).

I set the environment variable '$PCP_CULLAFTER' in the pmlogger control file residing at '/etc/pcp/pmlogger/control.d/', and I could see it was present in the environment of the pmlogger process.

BUT, it didn't have any effect. After midnight, the logs had been correctly rotated, but no culling had taken place.

I looked at the script called 'pmlogger_daily', and it does not use the enviroment variable called '$PCP_CULLAFTER'.

The pmlogger control file looks like this

$version=1.1
$PCP_CULLAFTER=3
host_mon01 y n PCP_ARCHIVE_DIR/host_mon01 -r -T24h10m -t 10m -c gh_logger.config
host_col01 n n PCP_ARCHIVE_DIR/host_col01 -r -T24h10m -t 10m -c gh_logger.config

I'm trying to find (e.g. in the source code) where the environment variable 'PCP_CULLAFTER' is used, but I can't find it.

I want to get it working using the environment variable, as opposed to the other methods, because this avoids changing any of the files supplied in the PCP distribution.