From 6fb7b1c14242b0c8f26069a1557723f8aca39d68 Mon Sep 17 00:00:00 2001 From: Yannik <> Date: Wed, 26 Apr 2023 20:40:50 +0200 Subject: [PATCH] fix date parsing --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 53a3a15..088ad77 100644 --- a/src/main.rs +++ b/src/main.rs @@ -286,13 +286,16 @@ fn parse_line(line: &'_ str) -> Result, Error> { .parse() .map_err(|e| format!("could not parse priority {}: {}", prio, e))?; - let (date, line) = line.split_at(16); + let (date, line) = line.split_at(15); let rcvtime = chrono::Local::now(); // we need to prepend the current year and add timezone, as that is not stated in the logfile let logtime = parse_log_date(rcvtime.date_naive().year(), date) .map_err(|e| format!("could not parse logtime {}{} {}", date, line, e))?; let logtime = TimeZone::from_local_datetime(&Local, &logtime).unwrap(); + // skip seperator + let line = &line[1..]; + // this slightly differs from the rfc: - is considered non-terminating let (service, entry) = line .split_once(|c: char| !((c == '-') || c.is_alphanumeric()))