PMLOGGER_JANITOR(1)
π PMLOGGER_JANITOR π
okay bestie, welcome to the pmlogger_janitor page, part of the General Commands Manual section 1 π§Ήβ¨ β she's the lil cleanup crew for Performance Co-Pilot archive files and she does NOT get enough credit fr fr.
β¨ SYNOPSIS β¨
$PCP_BINADM_DIR/pmlogger_janitor [-NV?] [-c control] [-l logfile] [-X program] [-Y regex]
π§ DESCRIPTION π§
so like, most of the time you're not calling pmlogger_janitor yourself, okay? π
usually it gets called from pmlogger_check(1) to go clean up all the residual processes and state files left behind by moribund instances of pmlogger(1). it's giving janitorial main character energy, and honestly? iconic. π§½
if you do run pmlogger_janitor directly, bestie, it needs to be run as the user $PCP_USER β the one and only exception is when you're using the -N option. no cap. π
π OPTIONS π
-c control,--control=controlβ just likepmlogger_check (1)andpmlogger_daily(1),pmlogger_janitoris controlled by PCP logger control file(s) that spell out whichpmloggerinstances are being managed. the default control file is$PCP_PMLOGGERCONTROL_PATH, but you can point at an alternate one with-c. and get this πΈ β if the directory$PCP_PMLOGGERCONTROL_PATH.dexists (orcontrol.dif you used-c), then the contents of any additional control files in there get appended to the main control file (which has to exist, periodt).-l file,--logfile=fileβ so that mail doesn't get sent by accident when this script runs fromcron(8)orsystemd(1), diagnostics always go to log files. by default that file is$PCP_LOG_DIR/pmlogger/pmlogger_janitor.logbut you can switch it up with-l. π«Ά if that log file already exists when the script starts, it gets renamed with a.prevsuffix first (which overwrites any log file saved earlier π) before diagnostics get written out.-N,--showmeβ turns on a "show me" mode where the actions are echoed but not executed, in the style ofmake -n. using-Ntogether with-Vmaximizes the diagnostic capabilities for debugging. lowkey the best combo for snooping. π-V,--verboseβ enables verbose tracing. by defaultpmlogger_janitorgenerates no output unless some error or warning condition pops up. a second-Vincreases the verbosity even more. and again β using-Nin conjunction with-Vmaximizes the diagnostic capabilities for debugging. β¨-X program,--compressor=programβ specifies the program to use for compression. refer topmlogger_daily(1)for details. ποΈ-Y regex,--regex=regexβ lets you hand over a regular expression that causes files in the set of files matched for compression to be omitted. refer topmlogger_daily(1)for details. π―-?,--helpβ display usage message and exit. the classic. π
π OPERATION π
pmlogger_janitor operates in a number of passes looking for things to cleanup. it's a whole multi-pass skincare routine, but for stale processes. π§
Pass 1 β scan the pmlogger port map files in the $PCP_TMP_DIR/pmlogger directory. use the process id (PID) from the name of the port map file and ps(1) to check, and if the process exists and it "looks like" an active pmlogger, append the PID and the directory where the archive is being written (extracted from the port map file) to a list of interest. otherwise the port map file is assumed to be associated with a pmlogger that has exited and the port map file is removed. bye boo π
Pass 2 β use ps(1) to scan all processes and identify any pmlogger instances that were started by pmlogger_check(3) or pmlogger_daily(3). these will have a signature -m option in their arguments. append the PIDs and directories where the archive is being written (extracted from the command line arguments) to the list of interest. π΅οΈ
Pass 3 β parse all of the pmlogger.control(5) files from either the standard places, or control if the -c option is used. for each pmlogger instance, it should be in the list of interest, and if so remove it from that list.
if the list of interest is empty at the end of this Pass, we're done. slay, nothing to see here. π
Pass 4 β each process remaining in the list of interest is a pmlogger that is running but should not be, probably as a result of a change to the pmlogger.control(5) files. send each process a SIGTERM. π¨
Pass 5 β for each process remaining in the list of interest after Pass 3, compress any archives in the directory pmlogger was writing into. this is the only step where the -X and -Y options might be used. ποΈβ¨
Pass 6 β for each pmlogger sent a SIGTERM in Pass 4, check that it has exited and if not send it a SIGKILL. not me being the final boss ππ
π FILES π
$PCP_LOG_DIR/pmlogger/pmlogger_janitor.logβ if the previous execution ofpmlogger_janitorproduced any output it is saved here. the normal case is no output, in which case the file does not exist. π«§$PCP_ARCHIVE_DIR/SaveLogsβ if this directory exists, then the log file from the-largument forpmlogger_janitorwill be saved in this directory with the name of the format<date>-pmlogger_janitor.log.<pid>. this allows the log file to be inspected at a later time, even if severalpmlogger_janitorexecutions have been launched in the interim.$PCP_ARCHIVE_DIR/SaveLogsneeds to be owned by the user$PCP_USER. π$PCP_TMP_DIR/pmloggerβpmloggermaintains the files in this directory as the port map between the PID of thepmloggerinstance, the IPC port that may be used to control eachpmloggerinstance (as used bypmlc(1)), the name of the host wherepmcd(1)is providing the metrics forpmlogger, the remote connection string for the remote HTTP server that is receiving the logged data or the full path to the archive base name for a local logger and any annotation from the-mor-xoptions. all of this information is also available via thepmcd.pmlogger.*metrics, e.g.$ pminfo -f pmcd.pmloggerπ¦
πΈ PCP ENVIRONMENT πΈ
environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. on each installation, the file /etc/pcp.conf contains the local values for these variables. the $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5). π
π SEE ALSO π
PCPIntro(1), pmcd(1), pmlc(1), pmlogctl(1), pmlogger(1), pmlogger_check(1), pmlogger_daily(1), ps(1), systemd(1), pmlogger.control(5) and cron(8).
that's the whole page bestie, go forth and janitor responsibly π§Ήπ this lil queen ships with Performance Co-Pilot (that's the PCP source, mwah π) β and remember, she's section PMLOGGER_JANITOR(1) of the General Commands Manual, so cite her correctly or it's not giving academic integrity πβ¨π¦
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: pcp 7.1.1-1
- ubuntu stonking: pcp 7.2.1-2build1
- Copyright (c) 2025 Ken McDonell. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms