Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jabedude/acct
Rust crate for processing acct(5) files
https://github.com/jabedude/acct
acct accton crates file-processing log logging parsing rust
Last synced: about 1 month ago
JSON representation
Rust crate for processing acct(5) files
- Host: GitHub
- URL: https://github.com/jabedude/acct
- Owner: jabedude
- License: mit
- Created: 2018-10-13T20:42:42.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-02T15:43:10.000Z (about 4 years ago)
- Last Synced: 2024-08-10T23:12:46.755Z (5 months ago)
- Topics: acct, accton, crates, file-processing, log, logging, parsing, rust
- Language: Rust
- Size: 54.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![acct title](https://github.com/jabedude/acct/raw/master/acct.png)
# Rust acct - parse acct(5) files
[![Crates.io](https://img.shields.io/crates/v/acct.svg)](https://crates.io/crates/acct)
A library for handling UNIX process accounting files.
To install, add this line to your Cargo.toml:
```toml
[dependencies]
acct = "0.6.0"
```## Example
```rust
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::::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](https://docs.rs/acct)