Skip to content

jabedude/acct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d122222 · Nov 2, 2020

History

66 Commits
Dec 10, 2018
Oct 14, 2018
Nov 29, 2018
Dec 10, 2018
Nov 2, 2020
Nov 29, 2018
Nov 10, 2018

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages