# acctadm [process | task | flow | net]
扩展记帐功能可以支持四种记帐类型。acctadm 命令的可选操作数对应于以下记帐类型:
指定 –net 会显示网络记帐的状态。如果不使用 –net,则显示所有四种记帐类型的状态。
# acctadm -e extended -f filename net
其中 filename 包括用于捕获网络通信统计数据的日志文件的完整路径。可以在您指定的任何目录中创建日志文件。
# acctadm net
此示例说明了如何在系统中配置网络记帐以捕获和显示通信历史信息。
查看所有记帐类型的状态,如下所示:
# acctadm Task accounting: inactive Task accounting file: none Tracked task resources: none Untracked task resources: extended Process accounting: inactive Process accounting file: none Tracked process resources: none Untracked process resources: extended,host Flow accounting: inactive Flow accounting file: none Tracked flow resources: none Untracked flow resources: extended Net accounting: inactive Network accounting file: none Tracked Network resources: none Untracked Network resources: extended
输出显示网络记帐未处于活动状态。因此,应启用扩展网络记帐。
# acctadm -e extended -f /var/log/net.log net # acctadm net Net accounting: active Net accounting file: /var/log/net.log Tracked net resources: extended Untracked net resources: none