"lastcomm" now supports the "--pid" option
The "lastcomm" command now supports the "--pid" option. This option shows the process ID (PID) and parent-process ID (PPID) for each record if supported by the kernel.
Description of problem:
In rhel6, the lastcomm binary (part of the psacct package) included a patch which added a flag, --pid, which would print out the processes pid and ppid.
It looks like that patch (psacct-6.3.2-ppid.patch) was dropped in rhel7.
We've found it to be very useful and would like to see it restored in rhel7.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. lastcomm --pid
[root@garabaldi ~]# lastcomm --pid
lastcomm: unrecognized option '--pid'
Usage: lastcomm [-hpV] [-f file] [command] ... [user] ... [terminal] ...
[--forwards] [--file <file>] [--strict-match] [--print-controls]
[--user <name>] [--tty <name>] [--command <name>] [--debug]
[--show-paging] [--ahz <freq>] [--version] [--help]
The system's default process accounting file is /var/account/pacct.
[root@ivanova fmhirtz]# lastcomm --pid | head -5
lastcomm root pts/0 0.38 secs Wed Aug 19 17:06 3573 3551
postmaster F postgres __ 0.00 secs Wed Aug 19 17:06 3571 2487
xauth S root pts/0 0.00 secs Wed Aug 19 17:06 3570 3551
bash F root pts/0 0.00 secs Wed Aug 19 17:06 3568 3551
id root pts/0 0.00 secs Wed Aug 19 17:06 3569 3568
The --pid switch was introduced by the previous component maintainer. Unfortunately the patch didn't get upstream for some reason. I could try to forward-port this and propagate upstream.
Let's see how that goes.
The project has a bug tracker on savannah.
You could also try to contact Markus Gothe <email@example.com> directly.
Created attachment 1249792 [details]
lastcomm shows PID and PPID if supported
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.