Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Nov 2000 15:03:34 -0600 (CST)
From:      Mike Meyer <mwm@mired.org>
To:        - <adolfo@conectia.es>
Cc:        questions@freebsd.org
Subject:   Re: Process Log
Message-ID:  <14859.4390.604607.588672@guru.mired.org>
In-Reply-To: <12111063@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
- <adolfo@conectia.es> types:
> How can I have a log of all the processes started by the system? In a
> format similar to 'ps'.

Similar to *which* ps format? And some of the information from ps
isn't really relevant (pid, resident set size, CPU STATE, etc.)

Anyway, you can start collecting statistics by doing:

	# mkdir /var/account
	# touch /var/account/acct
	# accton /var/account/acct

Setting accounting_enable="YES" in /etc/rc.conf will cause it to be
turned on during the boot process (but you'll miss processes that exit
before it's turned on).

The lastcomm and sa commands will then print information about the
processes. If you can't use those to get a format acceptable to you,
then look at /usr/include/sys/acct.h; that's the format for the
records in the log file. Writing a program that prints what you want
is the second most trivial interesting program you can write ("Hello
world" isn't interesting, cat is the first, cat with reformatting is
the second, and that's what you're doing).

	<mike



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14859.4390.604607.588672>