summaryrefslogtreecommitdiff
path: root/src/systemd/journal.rs
blob: fa01c49b2edbfffa1983ae5092947bec45431b83 (plain)
1
2
3
4
5
6
7
8
9
use std::process::Command;
use std::io;

pub fn get_log(unit: &str, lines: i32) -> io::Result<String> {
    let status = try!(Command::new("journalctl")
                          .args(&["-u", unit, "-n", &lines.to_string()])
                          .output());
    Ok(String::from_utf8_lossy(&status.stdout).into_owned())
}