#accounting #process #unix #pacct

bin+lib acct

Crate for reading data from acct(5) files

7 releases (breaking)

Uses old Rust 2015

0.6.0 Nov 29, 2018
0.5.0 Oct 30, 2018
0.4.0 Oct 29, 2018
0.3.0 Oct 25, 2018
0.1.1 Oct 14, 2018

#753 in Unix APIs

29 downloads per month

MIT/Apache

16KB
206 lines

acct title

Rust acct - parse acct(5) files

Crates.io

A library for handling UNIX process accounting files.

To install, add this line to your Cargo.toml:

[dependencies]
acct = "0.6.0"

Example

    let mut file = File::open(acct_file).unwrap();

    let acct_file = AcctFile::new(&mut file).unwrap();
    for acct in &acct_file.records {
        let datetime = DateTime::<Utc>::from(acct.creation_time);
        let timestamp_str = datetime.format("%Y-%m-%d %H:%M:%S.%f").to_string();
        println!("{}\t{}\t{:?}\tSU:{}", acct.command, acct.username, timestamp_str, acct.was_super_user());
    }

Documentation

acct reference


lib.rs:

This is documentation for the acct crate.

The acct crate is meant to be used for handling and processing the acct(5) file generated by UNIX process accounting.

Dependencies

~2.2–3MB
~54K SLoC