diff --git a/Cargo.lock b/Cargo.lock index 279969f..0af8161 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -327,9 +327,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.27" +version = "1.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" +checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" dependencies = [ "jobserver", "libc", @@ -1062,9 +1062,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb" +checksum = "7f66d5bd4c6f02bf0542fad85d626775bab9258cf795a4256dcaf3161114d1df" dependencies = [ "base64", "bytes", @@ -1227,9 +1227,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.12" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4adb2ee6ad319a912210a36e56e3623555817bcc877a7e6e8802d1d69c4d8056" +checksum = "70a646d946d06bedbbc4cac4c218acf4bbf2d87757a784857025f4d447e4e1cd" dependencies = [ "console", "portable-atomic", @@ -2720,9 +2720,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.46.0" +version = "1.46.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1140bb80481756a8cbe10541f37433b459c5aa1e727b4c020fbfebdc25bf3ec4" +checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" dependencies = [ "backtrace", "bytes", @@ -2771,12 +2771,11 @@ dependencies = [ [[package]] name = "tokio-tasks" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50938bb2e66bbf634a64a8cb2e7ecd8eb5801b116a778f7838dafab486dea1d8" +checksum = "2fbc0159e60f54b70502626c04bdec1c128566699d2dd4f97c5f00cb632f0f5a" dependencies = [ "futures-util", - "lazy_static", "log", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index 2f4746b..16daa8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ hex = {version = "0.4", optional = true} http-body-util = "0.1" hyper = { version = "1", features = ["server", "http1"], optional=true} hyper-util = { version = "0.1", features = ["http1", "tokio", "server"]} -indicatif = "0.17" +indicatif = "0.18" itertools = "0.14" libc = {version="0.2", optional = true} log = {version = "0.4", optional=true} @@ -79,7 +79,7 @@ sqlx-type = {version = "0.4", optional = true} tempfile = {version="3", optional=true} tokio = { version = "1", default-features = false, features=['rt', 'net', 'fs', 'sync', 'macros', 'time', 'process', 'signal', 'io-std', 'rt-multi-thread'] } tokio-rustls = "0.26" -tokio-tasks = {version = "0.2", optional=true} +tokio-tasks = {version = "0.3", optional=true} tokio-tungstenite = { version = "0.27", features=['rustls-tls-webpki-roots']} tokio-util = {version = "0.7", features = ["io"], optional = true} totp-rs= {version="5", features = ["otpauth"], optional = true} diff --git a/src/bin/sadmin/service_control.rs b/src/bin/sadmin/service_control.rs index 7f601fc..4e72385 100644 --- a/src/bin/sadmin/service_control.rs +++ b/src/bin/sadmin/service_control.rs @@ -325,13 +325,20 @@ pub async fn run_logs(args: Logs) -> Result<()> { let mut child = cmd.spawn()?; let stdout = child.stdout.take().unwrap(); let mut stdout = std::io::BufReader::new(stdout); - let mut line = String::new(); + let mut line = Vec::new(); let mut instances = std::collections::HashMap::new(); let mut print_date = None; let now: DateTime = Local::now(); - while stdout.read_line(&mut line)? != 0 { - let l: LogLine = serde_json::from_str(line.trim()) - .with_context(|| format!("Parsing log line {line}"))?; + + loop { + line.clear(); + stdout.read_until(b'\n', &mut line)?; + if line.is_empty() { + break; + } + let l = line.trim_ascii(); + let l: LogLine = serde_json::from_slice(l) + .with_context(|| format!("Parsing log line '{}'", String::from_utf8_lossy(l)))?; let t: DateTime = match l.__realtime_timestamp { Some(v) => { let t: i64 = v