Member-only story

System Process Accounting in Linux with psacct

Johan Louwers
4 min readNov 6, 2024

--

System Process Accounting in Linux with psacct

System process accounting, or psacct, is a powerful tool in the Linux ecosystem, allowing organizations to achieve a high degree of visibility into system processes. By enabling detailed accounting of user activity and resource utilization, it provides essential insights that aid in security, compliance, and resource optimization. In enterprise environments, psacct serves as a cornerstone for process auditing and accountability, granting administrators the data needed to monitor system activity, detect anomalies, and enforce governance policies across distributed systems. With growing requirements for transparency and security in IT infrastructures, psacct offers a mechanism to capture granular operational data at the kernel level, creating a solid foundation for Linux security and performance tuning.

Technology View

Implementing psacct allows administrators to record every command a user executes, monitor the resources each command consumes, and gain visibility into system utilization. psacct operates by tapping into Linux’s process tracking capabilities, utilizing kernel modules that maintain records of process and user activities. This logging takes place continuously, and records are stored for system administrators to analyze at any time. This functionality is particularly useful for detecting unusual patterns, verifying compliance with security policies, and troubleshooting unexpected resource usage.

For instance, setting up psacct on Oracle Linux 8 is straightforward and emphasizes the strength of Linux’s built-in accounting features. A simple Bash example demonstrates its implementation and functionality. To start:

# Install psacct if not already installed
sudo dnf install psacct -y

# Enable and start the psacct service to start tracking processes
sudo systemctl enable psacct
sudo systemctl start psacct

# Confirm the service is active
systemctl status psacct

With psacct active, all user processes are now logged, making it easy to view a summary of command executions and their resource footprints. Commands such as sa, ac, and lastcomm allow administrators to query specific user activities, access cumulative resource usage, and track the commands run on the system, respectively.

# View all commands…

--

--

Johan Louwers
Johan Louwers

Written by Johan Louwers

Johan Louwers is a technology enthousiasts with a long background in supporting enterprises and startups alike as CTO, Chief Enterprise Architect and developer.

No responses yet