On 2012/05/28 10:53, Lawrence Teo wrote: > On Mon, Mar 19, 2012 at 12:50:12PM +0100, Marc Espie wrote: > > The more I think about it, the more I fail to see the value. > > Consider that any pkg_add/pkg_delete that actually changes installed > > packages *will* lock the database anyways, so by nature, all relevant > > runs of pkg_add/pkg_delete will happen in sequence. > > > > Hence, there's totally no ambiguity in the log lines. If I remove the pids > > in there, I still have no trouble figuring out what happened. > > > > When I look at those logs, I usually have to look at the time anyways, > > so in the above case, figuring out that libreoffice and kdiff3 are > > different runs of pkg_add is not that hard... > > Thank you for your comments. > > If I remove the PIDs from the above logs, part of it would look like > this: > > Mar 3 22:16:51 obsd-amd64 pkg_add: Added redland-1.0.8p1 > Mar 3 22:16:54 obsd-amd64 pkg_add: Added mozilla-dicts-en-GB-1.3 > Mar 3 22:16:56 obsd-amd64 pkg_add: Added hunspell-1.2.12 > Mar 3 22:23:22 obsd-amd64 pkg_add: Added libreoffice-126.96.36.199v0 > > Just relying on those timestamps alone without PIDs, it looks like > redland, mozilla-dicts, and hunspell are part of the same run, while > libreoffice is a different run. > > However, with PIDs it is clear that they are part of the same run, where > it so happened that it took almost 6.5 minutes to install the > libreoffice package on this machine: > > Mar 3 22:16:51 obsd-amd64 pkg_add: Added redland-1.0.8p1 > Mar 3 22:16:54 obsd-amd64 pkg_add: Added mozilla-dicts-en-GB-1.3 > Mar 3 22:16:56 obsd-amd64 pkg_add: Added hunspell-1.2.12 > Mar 3 22:23:22 obsd-amd64 pkg_add: Added libreoffice-188.8.131.52v0
If this is necessary at all, I'd honestly prefer log entries like "started update" and "finished update" rather than logging PIDs. It's unlikely of course, but PIDs are random, so you can't rely on the PID alone to identify whether two log entries with a certain PID are from the same run. > My goal is to help the bleary-eyed sysadmin figure out what in the world > s/he did after working on a project all night long. :) This is certainly not restricted to pkg_add. I find sudo logs quite useful for this.