public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser
@ 2024-02-20 10:06 Mira Limbeck
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 2/5] tests: improve test output consistency Mira Limbeck
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Mira Limbeck @ 2024-02-20 10:06 UTC (permalink / raw)
  To: pmg-devel

The compatibility code was added to the new rfc3339 code path temporarily so
that the old code path would not be changed before the PMG 8 release.

Now move it to the old time format code to make sure the rfc3339 code path
works as expected. Since we have all the information we need (year, month,
day, hours, minutes, seconds, timezone), there's no need for a workaround in
this code path.

As a side effect of parsing the time format `YYYY-MM-DD HH:MM:SS` in
localtime, it's now possible to parse an rfc3339 compliant format
(except for fractional seconds).

The change needs to be accompanied by one in pmg-api MailTracker.pmg to
keep the time displayed in the GUI the same for the old time format, and
correct for the new rfc3339 format.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
I've tested it locally with both old timestamp format and new one, but
running it on more logs would not hurt

Since we use only the start time to calculate the timezone offset, it
will not be reliable in all cases, especially when the end time offset
differs from the start time.

v3:
 - changed file in range of start/end time check to use the start time
   timezone offset, which allowed us to remove the timezone_offset
   member of the parser struct

v2:
 - removed TODO line
 - fixed start-/endtime offset mentioned by @stoiko on the rfc
 - added rfc3339 start-/endtime handling as suggested by @dominik since
   it eases parsing the YYYY-MM-DD HH:MM:SS format as localtime rather
   than UTC
 - added tests in another patch

 src/main.rs | 65 ++++++++++++++++++++++++++++++-----------------------
 src/time.rs | 23 ++++++++++++++++++-
 2 files changed, 59 insertions(+), 29 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index e7aeeb4..5d4f86e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,7 +9,7 @@ use std::io::BufReader;
 use std::io::BufWriter;
 use std::io::Write;
 
-use anyhow::{bail, Error};
+use anyhow::{bail, Context, Error};
 use flate2::read;
 use libc::time_t;
 
@@ -90,12 +90,12 @@ fn main() -> Result<(), Error> {
 
     println!(
         "# Start: {} ({})",
-        time::strftime(c_str!("%F %T"), &parser.start_tm)?,
+        proxmox_time::strftime_local("%F %T", parser.options.start)?,
         parser.options.start
     );
     println!(
         "# End: {} ({})",
-        time::strftime(c_str!("%F %T"), &parser.end_tm)?,
+        proxmox_time::strftime_local("%F %T", parser.options.end)?,
         parser.options.end
     );
 
@@ -1681,8 +1681,6 @@ struct Parser {
     string_match: bool,
 
     lines: u64,
-
-    timezone_offset: time_t,
 }
 
 impl Parser {
@@ -1708,7 +1706,6 @@ impl Parser {
             ctime: 0,
             string_match: false,
             lines: 0,
-            timezone_offset: ltime.tm_gmtoff,
         })
     }
 
@@ -1787,7 +1784,11 @@ impl Parser {
                 line,
                 self.current_year,
                 self.current_month,
-                self.timezone_offset,
+                // use start time for timezone offset in parse_time_no_year rather than the
+                // timezone offset of the current time
+                // this is required for cases where current time is in standard time, while start
+                // time is in summer time or the other way around
+                self.start_tm.tm_gmtoff,
             ) {
                 Some(t) => t,
                 None => continue,
@@ -1876,7 +1877,7 @@ impl Parser {
                             &buffer[0..size],
                             self.current_year,
                             self.current_month,
-                            self.timezone_offset,
+                            self.start_tm.tm_gmtoff,
                         ) {
                             // found the earliest file in the time frame
                             if time < self.options.start {
@@ -1896,7 +1897,7 @@ impl Parser {
                             &buffer[0..size],
                             self.current_year,
                             self.current_month,
-                            self.timezone_offset,
+                            self.start_tm.tm_gmtoff,
                         ) {
                             if time < self.options.start {
                                 break;
@@ -1920,12 +1921,14 @@ impl Parser {
         }
 
         if let Some(start) = args.opt_value_from_str::<_, String>(["-s", "--starttime"])? {
-            if let Ok(res) = time::strptime(&start, c_str!("%F %T")) {
-                self.options.start = res.as_utc_to_epoch();
-                self.start_tm = res;
-            } else if let Ok(res) = time::strptime(&start, c_str!("%s")) {
-                self.options.start = res.as_utc_to_epoch();
-                self.start_tm = res;
+            if let Ok(epoch) = proxmox_time::parse_rfc3339(&start).or_else(|_| {
+                time::date_to_rfc3339(&start).and_then(|s| proxmox_time::parse_rfc3339(&s))
+            }) {
+                self.options.start = epoch;
+                self.start_tm = time::Tm::at_local(epoch).context("failed to parse start time")?;
+            } else if let Ok(epoch) = start.parse::<time_t>() {
+                self.options.start = epoch;
+                self.start_tm = time::Tm::at_local(epoch).context("failed to parse start time")?;
             } else {
                 bail!("failed to parse start time");
             }
@@ -1939,12 +1942,14 @@ impl Parser {
         }
 
         if let Some(end) = args.opt_value_from_str::<_, String>(["-e", "--endtime"])? {
-            if let Ok(res) = time::strptime(&end, c_str!("%F %T")) {
-                self.options.end = res.as_utc_to_epoch();
-                self.end_tm = res;
-            } else if let Ok(res) = time::strptime(&end, c_str!("%s")) {
-                self.options.end = res.as_utc_to_epoch();
-                self.end_tm = res;
+            if let Ok(epoch) = proxmox_time::parse_rfc3339(&end).or_else(|_| {
+                time::date_to_rfc3339(&end).and_then(|s| proxmox_time::parse_rfc3339(&s))
+            }) {
+                self.options.end = epoch;
+                self.end_tm = time::Tm::at_local(epoch).context("failed to parse end time")?;
+            } else if let Ok(epoch) = end.parse::<time_t>() {
+                self.options.end = epoch;
+                self.end_tm = time::Tm::at_local(epoch).context("failed to parse end time")?;
             } else {
                 bail!("failed to parse end time");
             }
@@ -2196,11 +2201,11 @@ fn parse_time(
     cur_month: i64,
     timezone_offset: time_t,
 ) -> Option<(time_t, &'_ [u8])> {
-    parse_time_with_year(data, timezone_offset)
-        .or_else(|| parse_time_no_year(data, cur_year, cur_month))
+    parse_time_with_year(data)
+        .or_else(|| parse_time_no_year(data, cur_year, cur_month, timezone_offset))
 }
 
-fn parse_time_with_year(data: &'_ [u8], timezone_offset: time_t) -> Option<(time_t, &'_ [u8])> {
+fn parse_time_with_year(data: &'_ [u8]) -> Option<(time_t, &'_ [u8])> {
     let mut timestamp_buffer = [0u8; 25];
 
     let count = data.iter().take_while(|b| **b != b' ').count();
@@ -2227,13 +2232,17 @@ fn parse_time_with_year(data: &'_ [u8], timezone_offset: time_t) -> Option<(time
     match proxmox_time::parse_rfc3339(unsafe {
         std::str::from_utf8_unchecked(&timestamp_buffer[0..timestamp_len])
     }) {
-        // TODO handle timezone offset in old code path instead
-        Ok(ltime) => Some((ltime + timezone_offset, data)),
+        Ok(ltime) => Some((ltime, data)),
         Err(_err) => None,
     }
 }
 
-fn parse_time_no_year(data: &'_ [u8], cur_year: i64, cur_month: i64) -> Option<(time_t, &'_ [u8])> {
+fn parse_time_no_year(
+    data: &'_ [u8],
+    cur_year: i64,
+    cur_month: i64,
+    timezone_offset: time_t,
+) -> Option<(time_t, &'_ [u8])> {
     if data.len() < 15 {
         return None;
     }
@@ -2338,7 +2347,7 @@ fn parse_time_no_year(data: &'_ [u8], cur_year: i64, cur_month: i64) -> Option<(
         _ => &data[1..],
     };
 
-    Some((ltime, data))
+    Some((ltime - timezone_offset, data))
 }
 
 type ByteSlice<'a> = &'a [u8];
diff --git a/src/time.rs b/src/time.rs
index 5851496..9a2ce73 100644
--- a/src/time.rs
+++ b/src/time.rs
@@ -149,7 +149,8 @@ pub fn strftime(format: &CStr, tm: &Tm) -> Result<String, Error> {
 
 /// Wrapper around `strptime(3)` to parse time strings.
 pub fn strptime(time: &str, format: &CStr) -> Result<Tm, Error> {
-    let mut out = MaybeUninit::<libc::tm>::uninit();
+    // zero memory because strptime does not necessarily initialize tm_isdst, tm_gmtoff and tm_zone
+    let mut out = MaybeUninit::<libc::tm>::zeroed();
 
     let time = CString::new(time).map_err(|_| format_err!("time string contains nul bytes"))?;
 
@@ -167,3 +168,23 @@ pub fn strptime(time: &str, format: &CStr) -> Result<Tm, Error> {
 
     Ok(Tm(unsafe { out.assume_init() }))
 }
+
+pub fn date_to_rfc3339(date: &str) -> Result<String, Error> {
+    // parse the YYYY-MM-DD HH:MM:SS format for the timezone info
+    let ltime = strptime(date, c_str!("%F %T"))?;
+
+    // strptime assume it is in UTC, but we want to interpret it as local time and get the timezone
+    // offset (tm_gmtoff) which we can then append to be able to parse it as rfc3339
+    let ltime = Tm::at_local(ltime.as_utc_to_epoch())?;
+
+    let mut s = date.replacen(' ', "T", 1);
+    if ltime.tm_gmtoff != 0 {
+        let sign = if ltime.tm_gmtoff < 0 { '-' } else { '+' };
+        let minutes = (ltime.tm_gmtoff / 60) % 60;
+        let hours = ltime.tm_gmtoff / (60 * 60);
+        s.push_str(&format!("{}{:02}:{:02}", sign, hours, minutes));
+    } else {
+        s.push('Z');
+    }
+    Ok(s)
+}
-- 
2.39.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] [PATCH v3 pmg-log-tracker 2/5] tests: improve test output consistency
  2024-02-20 10:06 [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Mira Limbeck
@ 2024-02-20 10:06 ` Mira Limbeck
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 3/5] tests: update for log tracker time handling changes Mira Limbeck
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Mira Limbeck @ 2024-02-20 10:06 UTC (permalink / raw)
  To: pmg-devel

`expected` and `command` are more helpful than `new` and `old`.
the order of `expected` and `command` should now always be the same:
expected before command

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
this patch can be applied regardless of any of the others. it doesn't
change any functionality, but just reorders output in case of errors to
be more consistent

v3:
 - unchanged

 tests/utils.rs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/utils.rs b/tests/utils.rs
index 936efc9..f303fc3 100644
--- a/tests/utils.rs
+++ b/tests/utils.rs
@@ -26,21 +26,21 @@ pub fn compare_output<R: BufRead, R2: BufRead>(command: R, expected: R2) {
         expected_lines.len(),
         command_lines.len()
     );
-    for (old, new) in expected_lines.iter().zip(command_lines.iter()) {
-        if new.starts_with("# ") && old.starts_with("# ") {
+    for (expected, command) in expected_lines.iter().zip(command_lines.iter()) {
+        if command.starts_with("# ") && expected.starts_with("# ") {
             continue;
-        } else if new.starts_with("# ") {
+        } else if command.starts_with("# ") {
             assert!(
                 false,
                 "comment line found in command output, but not in expected output"
             );
-        } else if old.starts_with("# ") {
+        } else if expected.starts_with("# ") {
             assert!(
                 false,
                 "comment line found in expected output, but not in command output"
             );
         }
 
-        assert_eq!(new, old);
+        assert_eq!(expected, command);
     }
 }
-- 
2.39.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] [PATCH v3 pmg-log-tracker 3/5] tests: update for log tracker time handling changes
  2024-02-20 10:06 [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Mira Limbeck
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 2/5] tests: improve test output consistency Mira Limbeck
@ 2024-02-20 10:06 ` Mira Limbeck
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 4/5] cleanup: remove unused strftime function Mira Limbeck
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Mira Limbeck @ 2024-02-20 10:06 UTC (permalink / raw)
  To: pmg-devel

since we now calculate the time in UTC rather than local time, the time
values of each test had to be touched. those should differ by `E10`
(3600 seconds) in most cases since we set the TZ to Europe/Vienna for
the tests.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
v3:
 - unchanged

 tests/test_output_after_queue                 | 40 ++++----
 tests/test_output_after_queue_duplicate_msgid |  8 +-
 tests/test_output_after_queue_host            | 18 ++--
 tests/test_output_after_queue_qid             |  4 +-
 .../test_output_after_queue_relay_before_lmtp |  8 +-
 tests/test_output_after_queue_search_string   | 12 +--
 tests/test_output_before_queue                | 40 ++++----
 tests/test_output_before_queue_from_to        |  6 +-
 tests/test_output_before_queue_host           | 34 +++----
 ...before_queue_mixed_accept_block_quarantine |  8 +-
 .../test_output_before_queue_mixed_downstream | 18 ++--
 tests/test_output_before_queue_qid            | 10 +-
 tests/test_output_before_queue_search_string  | 12 +--
 tests/test_output_before_queue_syntax_reject  |  6 +-
 tests/test_output_before_queue_to             |  6 +-
 .../test_output_before_queue_to_search_string | 18 ++--
 tests/test_output_time_rfc3339_mixed          | 22 ++---
 tests/test_output_timechange                  | 94 +++++++++----------
 18 files changed, 182 insertions(+), 182 deletions(-)

diff --git a/tests/test_output_after_queue b/tests/test_output_after_queue
index dfcd4ee..6e9f277 100644
--- a/tests/test_output_after_queue
+++ b/tests/test_output_after_queue
@@ -5,11 +5,11 @@
 # End Query Options
 
 QENTRY: 21BCE3807B6
-CTIME: 5FDCCEB8
+CTIME: 5FDCC0A8
 SIZE: 2053
 CLIENT: pmg.localhost[192.168.22.40]
 MSGID: <xyz>
-TO:5FDCCEB8:21BCE3807B6:Q: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (381C6F5DFA39502F470)
+TO:5FDCC0A8:21BCE3807B6:Q: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (381C6F5DFA39502F470)
 SMTP:
 L00000002 Dec 18 15:46:00 pmg postfix/smtpd[24784]: connect from pmg.localhost[192.168.22.40]
 L00000003 Dec 18 15:46:00 pmg postfix/smtpd[24784]: 21BCE3807B6: client=pmg.localhost[192.168.22.40]
@@ -25,14 +25,14 @@ L0000000A Dec 18 15:46:00 pmg postfix/lmtp[24788]: 21BCE3807B6: to=<pmgtest@loca
 L0000000B Dec 18 15:46:00 pmg postfix/qmgr[24651]: 21BCE3807B6: removed
 
 QENTRY: CFC5F42740
-CTIME: 5FDCCFCE
+CTIME: 5FDCC1BE
 SIZE: 7102
 CLIENT: test.localdomain[192.168.22.40]
 MSGID: <xyz>
-TO:5FDCCFCE:CFC5F42740:A: from <test@test.localdomain> to <test4@localhost> (88F2E42667)
-TO:5FDCCFCE:CFC5F42740:A: from <test@test.localdomain> to <test3@localhost> (88F2E42667)
-TO:5FDCCFCE:CFC5F42740:A: from <test@test.localdomain> to <test2@localhost> (88F2E42667)
-TO:5FDCCFCE:CFC5F42740:A: from <test@test.localdomain> to <test1@localhost> (88F2E42667)
+TO:5FDCC1BE:CFC5F42740:A: from <test@test.localdomain> to <test4@localhost> (88F2E42667)
+TO:5FDCC1BE:CFC5F42740:A: from <test@test.localdomain> to <test3@localhost> (88F2E42667)
+TO:5FDCC1BE:CFC5F42740:A: from <test@test.localdomain> to <test2@localhost> (88F2E42667)
+TO:5FDCC1BE:CFC5F42740:A: from <test@test.localdomain> to <test1@localhost> (88F2E42667)
 SMTP:
 L0000000C Dec 18 15:50:34 proxmox-new postfix/smtpd[13169]: connect from test.localdomain[192.168.22.40]
 L0000000D Dec 18 15:50:34 proxmox-new postfix/smtpd[13169]: CFC5F42740: client=test.localdomain[192.168.22.40]
@@ -55,14 +55,14 @@ L00000022 Dec 18 15:50:38 proxmox-new postfix/lmtp[13174]: CFC5F42740: to=<test4
 L00000023 Dec 18 15:50:38 proxmox-new postfix/qmgr[18171]: CFC5F42740: removed
 
 QENTRY: 88F2E42667
-CTIME: 5FDCCFCE
+CTIME: 5FDCC1BE
 SIZE: 8037
 CLIENT: localhost.localdomain[127.0.0.1],
 MSGID: <xyz>
-TO:5FDCCFCE:88F2E42667:2: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCFCE:88F2E42667:2: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCFCE:88F2E42667:2: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCFCE:88F2E42667:2: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCC1BE:88F2E42667:2: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCC1BE:88F2E42667:2: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCC1BE:88F2E42667:2: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCC1BE:88F2E42667:2: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
 SMTP:
 L00000014 Dec 18 15:50:38 proxmox-new postfix/smtpd[13179]: connect from localhost.localdomain[127.0.0.1]
 L00000015 Dec 18 15:50:38 proxmox-new postfix/smtpd[13179]: 88F2E42667: client=localhost.localdomain[127.0.0.1], orig_client=test.localdomain[192.168.22.40]
@@ -77,19 +77,19 @@ L00000026 Dec 18 15:50:38 proxmox-new postfix/smtp[13180]: 88F2E42667: to=<test3
 L00000027 Dec 18 15:50:38 proxmox-new postfix/smtp[13180]: 88F2E42667: to=<test4@localhost>, relay=192.168.22.40[192.168.22.40]:25, delay=0.15, delays=0.05/0/0.04/0.05, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as C928BF624F6)
 L00000028 Dec 18 15:50:38 proxmox-new postfix/qmgr[18171]: 88F2E42667: removed
 
-SMTPD: T5FDCCFDAL00000000
-CTIME: 5FDCCFDA
+SMTPD: T5FDCC1CAL00000000
+CTIME: 5FDCC1CA
 CLIENT: 10.0.0.1
-TO:5FDCCFDA:T5FDCCFDAL00000000:N: from <rbl_reject_test@localhost.localdomain> to <test@reject.localhost.localdomain>
+TO:5FDCC1CA:T5FDCC1CAL00000000:N: from <rbl_reject_test@localhost.localdomain> to <test@reject.localhost.localdomain>
 LOGS:
 L00000029 Dec 18 15:50:50 proxmox-new postfix/postscreen[32700]: NOQUEUE: reject: RCPT from [10.0.0.1]:34453: 550 5.7.1 Service unavailable; client [10.0.0.1] blocked using zen.spamhaus.org; from=<rbl_reject_test@localhost.localdomain>, to=<test@reject.localhost.localdomain>, proto=ESMTP, helo=<localhost.localdomain>
 
 QENTRY: 0022C3801B5
-CTIME: 5FDCD100
+CTIME: 5FDCC2F0
 SIZE: 2053
 CLIENT: pmg.localhost[192.168.22.40]
 MSGID: <dc730f87-0b1d-3ecf-b9a5-5b4d910be95f@localhost>
-TO:5FDCD100:0022C3801B5:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (none)
+TO:5FDCC2F0:0022C3801B5:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (none)
 SMTP:
 L0000002A Dec 18 15:55:43 pmg postfix/smtpd[29323]: connect from pmg.localhost[192.168.22.40]
 L0000002B Dec 18 15:55:44 pmg postfix/smtpd[29323]: 0022C3801B5: client=pmg.localhost[192.168.22.40]
@@ -104,10 +104,10 @@ L0000002D Dec 18 15:55:44 pmg postfix/qmgr[24651]: 0022C3801B5: from=<mailtestse
 L00000034 Dec 18 15:55:44 pmg postfix/lmtp[29327]: 0022C3801B5: to=<pmgtest@localhost>, relay=127.0.0.1[127.0.0.1]:10023, delay=0.07, delays=0.02/0.01/0.02/0.02, dsn=2.7.0, status=sent (250 2.7.0 BLOCKED (3802E45DFA503808B06))
 L00000035 Dec 18 15:55:44 pmg postfix/qmgr[24651]: 0022C3801B5: removed
 
-SMTPD: T5FDCD200L00000001
-CTIME: 5FDCD200
+SMTPD: T5FDCC3F0L00000001
+CTIME: 5FDCC3F0
 CLIENT: 192.0.2.0
-TO:5FDCD200:T5FDCD200L00000001:N: from <info@test.example> to <>
+TO:5FDCC3F0:T5FDCC3F0L00000001:N: from <info@test.example> to <>
 LOGS:
 L00000037 Dec 18 16:00:00 pmg postfix/postscreen[42055]: NOQUEUE: reject: RCPT from [192.0.2.0]:38834: 550 5.7.1 Service unavailable; client [192.0.2.0] blocked using testbl.example; from=<info@test.example>, to=<>, proto=ESMTP, helo=<testhost.example>
 
diff --git a/tests/test_output_after_queue_duplicate_msgid b/tests/test_output_after_queue_duplicate_msgid
index 80e29dd..9f8bb0c 100644
--- a/tests/test_output_after_queue_duplicate_msgid
+++ b/tests/test_output_after_queue_duplicate_msgid
@@ -5,11 +5,11 @@
 # End Query Options
 
 QENTRY: A673520AB5
-CTIME: 5E26A944
+CTIME: 5E269B34
 SIZE: 162287
 CLIENT: localhost[127.0.0.1],
 MSGID: <redacted:msgid>
-TO:5E26A944:A673520AB5:2: from <redacted:returnpath@domain.tld> to <redacted:recipient@mydomain.tld> (192.168.1.002[192.168.1.002]:25)
+TO:5E269B34:A673520AB5:2: from <redacted:returnpath@domain.tld> to <redacted:recipient@mydomain.tld> (192.168.1.002[192.168.1.002]:25)
 SMTP:
 L0000000A Jan 21 07:33:24 pmghost postfix/smtpd[29375]: connect from localhost[127.0.0.1]
 L0000000B Jan 21 07:33:24 pmghost postfix/smtpd[29375]: A673520AB5: client=localhost[127.0.0.1], orig_client=pmghost.mydomain.tld[192.168.1.001]
@@ -21,11 +21,11 @@ L00000010 Jan 21 07:33:24 pmghost postfix/smtp[29376]: A673520AB5: to=<redacted:
 L00000011 Jan 21 07:33:24 pmghost postfix/qmgr[529]: A673520AB5: removed
 
 QENTRY: DEF2520A69
-CTIME: 5E26A944
+CTIME: 5E269B34
 SIZE: 161138
 CLIENT: pmghost.mydomain.tld[192.168.1.001]
 MSGID: <redacted:msgid>
-TO:5E26A944:DEF2520A69:A: from <redacted:returnpath@domain.tld> to <redacted:recipient@mydomain.tld> (A673520AB5)
+TO:5E269B34:DEF2520A69:A: from <redacted:returnpath@domain.tld> to <redacted:recipient@mydomain.tld> (A673520AB5)
 SMTP:
 L00000001 Jan 21 07:33:20 pmghost postfix/smtpd[29361]: connect from pmghost.mydomain.tld[192.168.1.001]
 L00000002 Jan 21 07:33:20 pmghost postfix/smtpd[29361]: DEF2520A69: client=pmghost.mydomain.tld[192.168.1.001]
diff --git a/tests/test_output_after_queue_host b/tests/test_output_after_queue_host
index 219bdb9..90da867 100644
--- a/tests/test_output_after_queue_host
+++ b/tests/test_output_after_queue_host
@@ -6,11 +6,11 @@
 # End Query Options
 
 QENTRY: 21BCE3807B6
-CTIME: 5FDCCEB8
+CTIME: 5FDCC0A8
 SIZE: 2053
 CLIENT: pmg.localhost[192.168.22.40]
 MSGID: <xyz>
-TO:5FDCCEB8:21BCE3807B6:Q: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (381C6F5DFA39502F470)
+TO:5FDCC0A8:21BCE3807B6:Q: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (381C6F5DFA39502F470)
 SMTP:
 L00000002 Dec 18 15:46:00 pmg postfix/smtpd[24784]: connect from pmg.localhost[192.168.22.40]
 L00000003 Dec 18 15:46:00 pmg postfix/smtpd[24784]: 21BCE3807B6: client=pmg.localhost[192.168.22.40]
@@ -26,14 +26,14 @@ L0000000A Dec 18 15:46:00 pmg postfix/lmtp[24788]: 21BCE3807B6: to=<pmgtest@loca
 L0000000B Dec 18 15:46:00 pmg postfix/qmgr[24651]: 21BCE3807B6: removed
 
 QENTRY: 88F2E42667
-CTIME: 5FDCCFCE
+CTIME: 5FDCC1BE
 SIZE: 8037
 CLIENT: localhost.localdomain[127.0.0.1],
 MSGID: <xyz>
-TO:5FDCCFCE:88F2E42667:2: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCFCE:88F2E42667:2: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCFCE:88F2E42667:2: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCFCE:88F2E42667:2: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCC1BE:88F2E42667:2: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCC1BE:88F2E42667:2: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCC1BE:88F2E42667:2: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCC1BE:88F2E42667:2: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
 SMTP:
 L00000014 Dec 18 15:50:38 proxmox-new postfix/smtpd[13179]: connect from localhost.localdomain[127.0.0.1]
 L00000015 Dec 18 15:50:38 proxmox-new postfix/smtpd[13179]: 88F2E42667: client=localhost.localdomain[127.0.0.1], orig_client=test.localdomain[192.168.22.40]
@@ -49,11 +49,11 @@ L00000027 Dec 18 15:50:38 proxmox-new postfix/smtp[13180]: 88F2E42667: to=<test4
 L00000028 Dec 18 15:50:38 proxmox-new postfix/qmgr[18171]: 88F2E42667: removed
 
 QENTRY: 0022C3801B5
-CTIME: 5FDCD100
+CTIME: 5FDCC2F0
 SIZE: 2053
 CLIENT: pmg.localhost[192.168.22.40]
 MSGID: <dc730f87-0b1d-3ecf-b9a5-5b4d910be95f@localhost>
-TO:5FDCD100:0022C3801B5:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (none)
+TO:5FDCC2F0:0022C3801B5:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (none)
 SMTP:
 L0000002A Dec 18 15:55:43 pmg postfix/smtpd[29323]: connect from pmg.localhost[192.168.22.40]
 L0000002B Dec 18 15:55:44 pmg postfix/smtpd[29323]: 0022C3801B5: client=pmg.localhost[192.168.22.40]
diff --git a/tests/test_output_after_queue_qid b/tests/test_output_after_queue_qid
index 6cc9a9e..791d29a 100644
--- a/tests/test_output_after_queue_qid
+++ b/tests/test_output_after_queue_qid
@@ -6,11 +6,11 @@
 # End Query Options
 
 QENTRY: 0022C3801B5
-CTIME: 5FDCD100
+CTIME: 5FDCC2F0
 SIZE: 2053
 CLIENT: pmg.localhost[192.168.22.40]
 MSGID: <dc730f87-0b1d-3ecf-b9a5-5b4d910be95f@localhost>
-TO:5FDCD100:0022C3801B5:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (none)
+TO:5FDCC2F0:0022C3801B5:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost> (none)
 SMTP:
 L0000002A Dec 18 15:55:43 pmg postfix/smtpd[29323]: connect from pmg.localhost[192.168.22.40]
 L0000002B Dec 18 15:55:44 pmg postfix/smtpd[29323]: 0022C3801B5: client=pmg.localhost[192.168.22.40]
diff --git a/tests/test_output_after_queue_relay_before_lmtp b/tests/test_output_after_queue_relay_before_lmtp
index c4d0fdf..df54c09 100644
--- a/tests/test_output_after_queue_relay_before_lmtp
+++ b/tests/test_output_after_queue_relay_before_lmtp
@@ -5,11 +5,11 @@
 # End Query Options
 
 QENTRY: A673520AB5
-CTIME: 5E26A944
+CTIME: 5E269B34
 SIZE: 162287
 CLIENT: localhost[127.0.0.1],
 MSGID: <redacted:msgid>
-TO:5E26A944:A673520AB5:2: from <redacted:returnpath@domain.tld> to <redacted:recipient@mydomain.tld> (192.168.1.002[192.168.1.002]:25)
+TO:5E269B34:A673520AB5:2: from <redacted:returnpath@domain.tld> to <redacted:recipient@mydomain.tld> (192.168.1.002[192.168.1.002]:25)
 SMTP:
 L00000009 Jan 21 07:33:24 pmghost postfix/smtpd[29375]: connect from localhost[127.0.0.1]
 L0000000A Jan 21 07:33:24 pmghost postfix/smtpd[29375]: A673520AB5: client=localhost[127.0.0.1], orig_client=pmghost.mydomain.tld[192.168.1.001]
@@ -21,11 +21,11 @@ L0000000F Jan 21 07:33:24 pmghost postfix/smtp[29376]: A673520AB5: to=<redacted:
 L00000010 Jan 21 07:33:24 pmghost postfix/qmgr[529]: A673520AB5: removed
 
 QENTRY: DEF2520A69
-CTIME: 5E26A944
+CTIME: 5E269B34
 SIZE: 161138
 CLIENT: pmghost.mydomain.tld[192.168.1.001]
 MSGID: <redacted:msgid>
-TO:5E26A944:DEF2520A69:A: from <redacted:returnpath@domain.tld> to <redacted:recipient@mydomain.tld> (A673520AB5)
+TO:5E269B34:DEF2520A69:A: from <redacted:returnpath@domain.tld> to <redacted:recipient@mydomain.tld> (A673520AB5)
 SMTP:
 L00000001 Jan 21 07:33:20 pmghost postfix/smtpd[29361]: connect from pmghost.mydomain.tld[192.168.1.001]
 L00000002 Jan 21 07:33:20 pmghost postfix/smtpd[29361]: DEF2520A69: client=pmghost.mydomain.tld[192.168.1.001]
diff --git a/tests/test_output_after_queue_search_string b/tests/test_output_after_queue_search_string
index f658b9d..a513167 100644
--- a/tests/test_output_after_queue_search_string
+++ b/tests/test_output_after_queue_search_string
@@ -5,17 +5,17 @@
 # END:       2020-12-18 16:00:00 (1608307200)
 # End Query Options
 
-SMTPD: T5FDCCFDAL00000000
-CTIME: 5FDCCFDA
+SMTPD: T5FDCC1CAL00000000
+CTIME: 5FDCC1CA
 CLIENT: 10.0.0.1
-TO:5FDCCFDA:T5FDCCFDAL00000000:N: from <rbl_reject_test@localhost.localdomain> to <test@reject.localhost.localdomain>
+TO:5FDCC1CA:T5FDCC1CAL00000000:N: from <rbl_reject_test@localhost.localdomain> to <test@reject.localhost.localdomain>
 LOGS:
 L00000029 Dec 18 15:50:50 proxmox-new postfix/postscreen[32700]: NOQUEUE: reject: RCPT from [10.0.0.1]:34453: 550 5.7.1 Service unavailable; client [10.0.0.1] blocked using zen.spamhaus.org; from=<rbl_reject_test@localhost.localdomain>, to=<test@reject.localhost.localdomain>, proto=ESMTP, helo=<localhost.localdomain>
 
-SMTPD: T5FDCD200L00000001
-CTIME: 5FDCD200
+SMTPD: T5FDCC3F0L00000001
+CTIME: 5FDCC3F0
 CLIENT: 192.0.2.0
-TO:5FDCD200:T5FDCD200L00000001:N: from <info@test.example> to <>
+TO:5FDCC3F0:T5FDCC3F0L00000001:N: from <info@test.example> to <>
 LOGS:
 L00000037 Dec 18 16:00:00 pmg postfix/postscreen[42055]: NOQUEUE: reject: RCPT from [192.0.2.0]:38834: 550 5.7.1 Service unavailable; client [192.0.2.0] blocked using testbl.example; from=<info@test.example>, to=<>, proto=ESMTP, helo=<testhost.example>
 
diff --git a/tests/test_output_before_queue b/tests/test_output_before_queue
index aca61b9..62ab849 100644
--- a/tests/test_output_before_queue
+++ b/tests/test_output_before_queue
@@ -4,10 +4,10 @@
 # End: 2020-12-18 15:40:00 (1608306000)
 # End Query Options
 
-SMTPD: T5FDCC4EFL00000000
-CTIME: 5FDCC4EF
+SMTPD: T5FDCB6DFL00000000
+CTIME: 5FDCB6DF
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC4EF:T5FDCC4EFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCB6DF:T5FDCB6DFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L00000002 Dec 18 15:04:15 pmg postfix/smtpd[21842]: connect from pmg.localhost[192.168.22.40]
 L00000003 Dec 18 15:04:15 pmg postfix/smtpd[21842]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -17,10 +17,10 @@ L00000007 Dec 18 15:04:15 pmg pmg-smtp-filter[1565]: 381C4E5DFA31DF9E90F: proces
 L00000008 Dec 18 15:04:15 pmg postfix/smtpd[21842]: proxy-reject: END-OF-MESSAGE: 554 5.7.1 Rejected for policy reasons (381C4E5DFA31DF9E90F); from=<mailtestsender2@localhost.localdomain> to=<pmgtest@localhost.localdomain> proto=ESMTP helo=<localhost.localdomain>
 L00000009 Dec 18 15:04:15 pmg postfix/smtpd[21842]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=0/1 commands=3/4
 
-SMTPD: T5FDCC572L00000000
-CTIME: 5FDCC572
+SMTPD: T5FDCB762L00000000
+CTIME: 5FDCB762
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC572:T5FDCC572L00000000:Q: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCB762:T5FDCB762L00000000:Q: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L0000000A Dec 18 15:06:26 pmg postfix/smtpd[21949]: connect from pmg.localhost[192.168.22.40]
 L0000000B Dec 18 15:06:26 pmg postfix/smtpd[21949]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -30,10 +30,10 @@ L00000010 Dec 18 15:06:26 pmg pmg-smtp-filter[1564]: 381C4E5DFA32622BFC4: proces
 L00000011 Dec 18 15:06:26 pmg postfix/smtpd[21949]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (381C4E5DFA32622BFC4); from=<mailtestsender2@localhost.localdomain> to=<pmgtest@localhost.localdomain> proto=ESMTP helo=<localhost.localdomain>
 L00000012 Dec 18 15:06:26 pmg postfix/smtpd[21949]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=1 commands=4
 
-SMTPD: T5FDCC5EAL00000000
-CTIME: 5FDCC5EA
+SMTPD: T5FDCB7DAL00000000
+CTIME: 5FDCB7DA
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC5EA:T5FDCC5EAL00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtes2@localhost.localdomain>
+TO:5FDCB7DA:T5FDCB7DAL00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtes2@localhost.localdomain>
 LOGS:
 L00000013 Dec 18 15:08:26 pmg postfix/smtpd[21949]: connect from pmg.localhost[192.168.22.40]
 L00000014 Dec 18 15:08:26 pmg postfix/smtpd[21949]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -43,10 +43,10 @@ L00000019 Dec 18 15:08:26 pmg pmg-smtp-filter[1564]: 381C4E5DFA32622BFC4: proces
 L0000001A Dec 18 15:08:26 pmg postfix/smtpd[21949]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (381C4E5DFA32622BFC4); from=<mailtestsender3@localhost.localdomain> to=<pmgtes2@localhost.localdomain> proto=ESMTP helo=<localhost.localdomain>
 L0000001B Dec 18 15:08:26 pmg postfix/smtpd[21949]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=1 commands=4
 
-SMTPD: T5FDCC662L00000000
-CTIME: 5FDCC662
+SMTPD: T5FDCB852L00000000
+CTIME: 5FDCB852
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC662:T5FDCC662L00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCB852:T5FDCB852L00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L0000001C Dec 18 15:10:26 pmg postfix/smtpd[21949]: connect from pmg.localhost[192.168.22.40]
 L0000001D Dec 18 15:10:26 pmg postfix/smtpd[21949]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -57,14 +57,14 @@ L00000023 Dec 18 15:10:26 pmg postfix/smtpd[21949]: proxy-accept: END-OF-MESSAGE
 L00000024 Dec 18 15:10:26 pmg postfix/smtpd[21949]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=1 commands=4
 
 QENTRY: 1C6B541C5D
-CTIME: 5FDCCD39
+CTIME: 5FDCBF29
 SIZE: 7298
 CLIENT: localhost.localdomain[127.0.0.1],
 MSGID: <xyz>
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
 SMTP:
 L00000025 Dec 18 15:36:32 proxmox-new postfix/smtpd[29902]: connect from test.localdomain[192.168.22.40]
 L00000026 Dec 18 15:36:33 proxmox-new postfix/smtpd[29902]: NOQUEUE: client=test.localdomain[192.168.22.40]
@@ -90,10 +90,10 @@ L00000036 Dec 18 15:36:37 proxmox-new postfix/smtp[29913]: 1C6B541C5D: to=<test3
 L00000037 Dec 18 15:36:37 proxmox-new postfix/smtp[29913]: 1C6B541C5D: to=<test4@localhost>, relay=192.168.22.40[192.168.22.40]:25, delay=0.15, delays=0.05/0/0.05/0.05, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as C19A3F62578)
 L00000038 Dec 18 15:36:37 proxmox-new postfix/qmgr[6194]: 1C6B541C5D: removed
 
-SMTPD: T5FDCCD46L00000000
-CTIME: 5FDCCD46
+SMTPD: T5FDCBF36L00000000
+CTIME: 5FDCBF36
 CLIENT: 10.0.0.1
-TO:5FDCCD46:T5FDCCD46L00000000:N: from <rbl_reject_test@localhost.localdomain> to <test@reject.localhost.localdomain>
+TO:5FDCBF36:T5FDCBF36L00000000:N: from <rbl_reject_test@localhost.localdomain> to <test@reject.localhost.localdomain>
 LOGS:
 L0000003A Dec 18 15:39:50 proxmox-new postfix/postscreen[32700]: NOQUEUE: reject: RCPT from [10.0.0.1]:34453: 550 5.7.1 Service unavailable; client [10.0.0.1] blocked using zen.spamhaus.org; from=<rbl_reject_test@localhost.localdomain>, to=<test@reject.localhost.localdomain>, proto=ESMTP, helo=<localhost.localdomain>
 
diff --git a/tests/test_output_before_queue_from_to b/tests/test_output_before_queue_from_to
index 610bf34..7e499d8 100644
--- a/tests/test_output_before_queue_from_to
+++ b/tests/test_output_before_queue_from_to
@@ -6,10 +6,10 @@
 # End: 2020-12-18 15:40:00 (1608306000)
 # End Query Options
 
-SMTPD: T5FDCC662L00000000
-CTIME: 5FDCC662
+SMTPD: T5FDCB852L00000000
+CTIME: 5FDCB852
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC662:T5FDCC662L00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCB852:T5FDCB852L00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L0000001C Dec 18 15:10:26 pmg postfix/smtpd[21949]: connect from pmg.localhost[192.168.22.40]
 L0000001D Dec 18 15:10:26 pmg postfix/smtpd[21949]: NOQUEUE: client=pmg.localhost[192.168.22.40]
diff --git a/tests/test_output_before_queue_host b/tests/test_output_before_queue_host
index 4595d25..5460e32 100644
--- a/tests/test_output_before_queue_host
+++ b/tests/test_output_before_queue_host
@@ -5,10 +5,10 @@
 # End: 2020-12-18 15:40:00 (1608306000)
 # End Query Options
 
-SMTPD: T5FDCC4EFL00000000
-CTIME: 5FDCC4EF
+SMTPD: T5FDCB6DFL00000000
+CTIME: 5FDCB6DF
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC4EF:T5FDCC4EFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCB6DF:T5FDCB6DFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L00000002 Dec 18 15:04:15 pmg postfix/smtpd[21842]: connect from pmg.localhost[192.168.22.40]
 L00000003 Dec 18 15:04:15 pmg postfix/smtpd[21842]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -18,10 +18,10 @@ L00000007 Dec 18 15:04:15 pmg pmg-smtp-filter[1565]: 381C4E5DFA31DF9E90F: proces
 L00000008 Dec 18 15:04:15 pmg postfix/smtpd[21842]: proxy-reject: END-OF-MESSAGE: 554 5.7.1 Rejected for policy reasons (381C4E5DFA31DF9E90F); from=<mailtestsender2@localhost.localdomain> to=<pmgtest@localhost.localdomain> proto=ESMTP helo=<localhost.localdomain>
 L00000009 Dec 18 15:04:15 pmg postfix/smtpd[21842]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=0/1 commands=3/4
 
-SMTPD: T5FDCC572L00000000
-CTIME: 5FDCC572
+SMTPD: T5FDCB762L00000000
+CTIME: 5FDCB762
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC572:T5FDCC572L00000000:Q: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCB762:T5FDCB762L00000000:Q: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L0000000A Dec 18 15:06:26 pmg postfix/smtpd[21949]: connect from pmg.localhost[192.168.22.40]
 L0000000B Dec 18 15:06:26 pmg postfix/smtpd[21949]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -31,10 +31,10 @@ L00000010 Dec 18 15:06:26 pmg pmg-smtp-filter[1564]: 381C4E5DFA32622BFC4: proces
 L00000011 Dec 18 15:06:26 pmg postfix/smtpd[21949]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (381C4E5DFA32622BFC4); from=<mailtestsender2@localhost.localdomain> to=<pmgtest@localhost.localdomain> proto=ESMTP helo=<localhost.localdomain>
 L00000012 Dec 18 15:06:26 pmg postfix/smtpd[21949]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=1 commands=4
 
-SMTPD: T5FDCC5EAL00000000
-CTIME: 5FDCC5EA
+SMTPD: T5FDCB7DAL00000000
+CTIME: 5FDCB7DA
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC5EA:T5FDCC5EAL00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtes2@localhost.localdomain>
+TO:5FDCB7DA:T5FDCB7DAL00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtes2@localhost.localdomain>
 LOGS:
 L00000013 Dec 18 15:08:26 pmg postfix/smtpd[21949]: connect from pmg.localhost[192.168.22.40]
 L00000014 Dec 18 15:08:26 pmg postfix/smtpd[21949]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -44,10 +44,10 @@ L00000019 Dec 18 15:08:26 pmg pmg-smtp-filter[1564]: 381C4E5DFA32622BFC4: proces
 L0000001A Dec 18 15:08:26 pmg postfix/smtpd[21949]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (381C4E5DFA32622BFC4); from=<mailtestsender3@localhost.localdomain> to=<pmgtes2@localhost.localdomain> proto=ESMTP helo=<localhost.localdomain>
 L0000001B Dec 18 15:08:26 pmg postfix/smtpd[21949]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=1 commands=4
 
-SMTPD: T5FDCC662L00000000
-CTIME: 5FDCC662
+SMTPD: T5FDCB852L00000000
+CTIME: 5FDCB852
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC662:T5FDCC662L00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCB852:T5FDCB852L00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L0000001C Dec 18 15:10:26 pmg postfix/smtpd[21949]: connect from pmg.localhost[192.168.22.40]
 L0000001D Dec 18 15:10:26 pmg postfix/smtpd[21949]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -58,14 +58,14 @@ L00000023 Dec 18 15:10:26 pmg postfix/smtpd[21949]: proxy-accept: END-OF-MESSAGE
 L00000024 Dec 18 15:10:26 pmg postfix/smtpd[21949]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=1 commands=4
 
 QENTRY: 1C6B541C5D
-CTIME: 5FDCCD39
+CTIME: 5FDCBF29
 SIZE: 7298
 CLIENT: localhost.localdomain[127.0.0.1],
 MSGID: <xyz>
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
 SMTP:
 L00000025 Dec 18 15:36:32 proxmox-new postfix/smtpd[29902]: connect from test.localdomain[192.168.22.40]
 L00000026 Dec 18 15:36:33 proxmox-new postfix/smtpd[29902]: NOQUEUE: client=test.localdomain[192.168.22.40]
diff --git a/tests/test_output_before_queue_mixed_accept_block_quarantine b/tests/test_output_before_queue_mixed_accept_block_quarantine
index 637b40a..8a0417a 100644
--- a/tests/test_output_before_queue_mixed_accept_block_quarantine
+++ b/tests/test_output_before_queue_mixed_accept_block_quarantine
@@ -5,13 +5,13 @@
 # End Query Options
 
 QENTRY: E1C6561393
-CTIME: 5EAAF183
+CTIME: 5EAAD563
 SIZE: 1436
 CLIENT: localhost[127.0.0.1],
 MSGID: <20200430134439.GE6794@test@localdomain>
-TO:5EAAF179:E1C6561393:R: from <senduser@test@localdomain> to <reject@test.recipient.example> (192.0.2.69[192.0.2.69]:25)
-TO:5EAAF178:E1C6561393:B: from <senduser@test@localdomain> to <blocked@test.recipient.example> (none)
-TO:5EAAF178:E1C6561393:Q: from <senduser@test@localdomain> to <quarantined@test.recipient.example> (612405EAAD648755DD)
+TO:5EAAD559:E1C6561393:R: from <senduser@test@localdomain> to <reject@test.recipient.example> (192.0.2.69[192.0.2.69]:25)
+TO:5EAAD558:E1C6561393:B: from <senduser@test@localdomain> to <blocked@test.recipient.example> (none)
+TO:5EAAD558:E1C6561393:Q: from <senduser@test@localdomain> to <quarantined@test.recipient.example> (612405EAAD648755DD)
 SMTP:
 L00000003 Apr 30 15:40:39 pmg6 postfix/smtpd[21615]: connect from unknown[2001:DB8:1:12::75]
 L00000004 Apr 30 15:40:39 pmg6 postfix/smtpd[21615]: Anonymous TLS connection established from unknown[2001:DB8:1:12::75]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)
diff --git a/tests/test_output_before_queue_mixed_downstream b/tests/test_output_before_queue_mixed_downstream
index 4536a05..c0e6d90 100644
--- a/tests/test_output_before_queue_mixed_downstream
+++ b/tests/test_output_before_queue_mixed_downstream
@@ -4,23 +4,23 @@
 # End: 2020-12-18 16:10:00 (1608307800)
 # End Query Options
 
-SMTPD: T5FDCD200L00000001
-CTIME: 5FDCD200
+SMTPD: T5FDCC3F0L00000001
+CTIME: 5FDCC3F0
 CLIENT: 192.0.2.0
-TO:5FDCD200:T5FDCD200L00000001:N: from <info@test.example> to <>
+TO:5FDCC3F0:T5FDCC3F0L00000001:N: from <info@test.example> to <>
 
 QENTRY: E2487636D9
-CTIME: 5FDCD233
+CTIME: 5FDCC423
 SIZE: 3628
 MSGID: <20200428171350.E2487636D9@pmg6.rosa.proxmox.com>
-TO:5FDCD233:E2487636D9:2: from <> to <sender@test.localdomain> (test.localdomain[192.0.2.0.70]:25)
+TO:5FDCC423:E2487636D9:2: from <> to <sender@test.localdomain> (test.localdomain[192.0.2.0.70]:25)
 
 QENTRY: B8010636D6
-CTIME: 5FDCD233
+CTIME: 5FDCC423
 SIZE: 1436
 CLIENT: localhost[127.0.0.1],
 MSGID: <20200428171349.GC5963@test.localdomain>
-TO:5FDCD232:B8010636D6:P: from <sender@test.localdomain> to <discard@test.recipient.example> (192.0.2.0.69[192.0.2.0.69]:25)
-TO:5FDCD232:B8010636D6:R: from <sender@test.localdomain> to <reject@test.recipient.example> (192.0.2.0.69[192.0.2.0.69]:25)
-TO:5FDCD232:B8010636D6:D: from <sender@test.localdomain> to <defer@test.recipient.example> (192.0.2.0.69[192.0.2.0.69]:25)
+TO:5FDCC422:B8010636D6:P: from <sender@test.localdomain> to <discard@test.recipient.example> (192.0.2.0.69[192.0.2.0.69]:25)
+TO:5FDCC422:B8010636D6:R: from <sender@test.localdomain> to <reject@test.recipient.example> (192.0.2.0.69[192.0.2.0.69]:25)
+TO:5FDCC422:B8010636D6:D: from <sender@test.localdomain> to <defer@test.recipient.example> (192.0.2.0.69[192.0.2.0.69]:25)
 
diff --git a/tests/test_output_before_queue_qid b/tests/test_output_before_queue_qid
index e2eb137..46728a2 100644
--- a/tests/test_output_before_queue_qid
+++ b/tests/test_output_before_queue_qid
@@ -6,14 +6,14 @@
 # End Query Options
 
 QENTRY: 1C6B541C5D
-CTIME: 5FDCCD39
+CTIME: 5FDCBF29
 SIZE: 7298
 CLIENT: localhost.localdomain[127.0.0.1],
 MSGID: <xyz>
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
-TO:5FDCCC85:1C6B541C5D:P: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test4@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test3@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test2@localhost> (192.168.22.40[192.168.22.40]:25)
+TO:5FDCBE75:1C6B541C5D:P: from <test@test.localdomain> to <test1@localhost> (192.168.22.40[192.168.22.40]:25)
 SMTP:
 L00000025 Dec 18 15:36:32 proxmox-new postfix/smtpd[29902]: connect from test.localdomain[192.168.22.40]
 L00000026 Dec 18 15:36:33 proxmox-new postfix/smtpd[29902]: NOQUEUE: client=test.localdomain[192.168.22.40]
diff --git a/tests/test_output_before_queue_search_string b/tests/test_output_before_queue_search_string
index da04042..2f57b8a 100644
--- a/tests/test_output_before_queue_search_string
+++ b/tests/test_output_before_queue_search_string
@@ -5,10 +5,10 @@
 # End: 2020-12-18 15:40:00 (1608306000)
 # End Query Options
 
-SMTPD: T5FDCC4EFL00000000
-CTIME: 5FDCC4EF
+SMTPD: T5FDCB6DFL00000000
+CTIME: 5FDCB6DF
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC4EF:T5FDCC4EFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCB6DF:T5FDCB6DFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L00000002 Dec 18 15:04:15 pmg postfix/smtpd[21842]: connect from pmg.localhost[192.168.22.40]
 L00000003 Dec 18 15:04:15 pmg postfix/smtpd[21842]: NOQUEUE: client=pmg.localhost[192.168.22.40]
@@ -18,10 +18,10 @@ L00000007 Dec 18 15:04:15 pmg pmg-smtp-filter[1565]: 381C4E5DFA31DF9E90F: proces
 L00000008 Dec 18 15:04:15 pmg postfix/smtpd[21842]: proxy-reject: END-OF-MESSAGE: 554 5.7.1 Rejected for policy reasons (381C4E5DFA31DF9E90F); from=<mailtestsender2@localhost.localdomain> to=<pmgtest@localhost.localdomain> proto=ESMTP helo=<localhost.localdomain>
 L00000009 Dec 18 15:04:15 pmg postfix/smtpd[21842]: disconnect from pmg.localhost[192.168.22.40] ehlo=1 mail=1 rcpt=1 data=0/1 commands=3/4
 
-SMTPD: T5FDCCD46L00000000
-CTIME: 5FDCCD46
+SMTPD: T5FDCBF36L00000000
+CTIME: 5FDCBF36
 CLIENT: 10.0.0.1
-TO:5FDCCD46:T5FDCCD46L00000000:N: from <rbl_reject_test@localhost.localdomain> to <test@reject.localhost.localdomain>
+TO:5FDCBF36:T5FDCBF36L00000000:N: from <rbl_reject_test@localhost.localdomain> to <test@reject.localhost.localdomain>
 LOGS:
 L0000003A Dec 18 15:39:50 proxmox-new postfix/postscreen[32700]: NOQUEUE: reject: RCPT from [10.0.0.1]:34453: 550 5.7.1 Service unavailable; client [10.0.0.1] blocked using zen.spamhaus.org; from=<rbl_reject_test@localhost.localdomain>, to=<test@reject.localhost.localdomain>, proto=ESMTP, helo=<localhost.localdomain>
 
diff --git a/tests/test_output_before_queue_syntax_reject b/tests/test_output_before_queue_syntax_reject
index 5be90db..383b5e7 100644
--- a/tests/test_output_before_queue_syntax_reject
+++ b/tests/test_output_before_queue_syntax_reject
@@ -4,10 +4,10 @@
 # End: 2020-08-27 14:05:00 (1598537100)
 # End Query Options
 
-SMTPD: T5F47BD58L00000000
-CTIME: 5F47BD58
+SMTPD: T5F47A138L00000000
+CTIME: 5F47A138
 CLIENT: pmgsender[192.168.22.40]
-TO:5F47BD58:T5F47BD58L00000000:N: from <test@pmgsender.local> to <test@pmgreceiver.local>
+TO:5F47A138:T5F47A138L00000000:N: from <test@pmgsender.local> to <test@pmgreceiver.local>
 LOGS:
 L00000001 Aug 27 14:04:08 pmg6 postfix/smtpd[7567]: connect from pmgsender[192.168.22.40]
 L00000002 Aug 27 14:04:08 pmg6 postfix/smtpd[7567]: Anonymous TLS connection established from pmgsender[192.168.22.40]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
diff --git a/tests/test_output_before_queue_to b/tests/test_output_before_queue_to
index 49793dd..5fe39bd 100644
--- a/tests/test_output_before_queue_to
+++ b/tests/test_output_before_queue_to
@@ -5,10 +5,10 @@
 # End: 2020-12-18 15:40:00 (1608306000)
 # End Query Options
 
-SMTPD: T5FDCC5EAL00000000
-CTIME: 5FDCC5EA
+SMTPD: T5FDCB7DAL00000000
+CTIME: 5FDCB7DA
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC5EA:T5FDCC5EAL00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtes2@localhost.localdomain>
+TO:5FDCB7DA:T5FDCB7DAL00000000:Q: from <mailtestsender3@localhost.localdomain> to <pmgtes2@localhost.localdomain>
 LOGS:
 L00000013 Dec 18 15:08:26 pmg postfix/smtpd[21949]: connect from pmg.localhost[192.168.22.40]
 L00000014 Dec 18 15:08:26 pmg postfix/smtpd[21949]: NOQUEUE: client=pmg.localhost[192.168.22.40]
diff --git a/tests/test_output_before_queue_to_search_string b/tests/test_output_before_queue_to_search_string
index 5fe963a..db7d14f 100644
--- a/tests/test_output_before_queue_to_search_string
+++ b/tests/test_output_before_queue_to_search_string
@@ -6,10 +6,10 @@
 # End: 2020-05-18 16:10:00 (1589818200)
 # End Query Options
 
-SMTPD: T5EC2B077L00000002
-CTIME: 5EC2B077
+SMTPD: T5EC29457L00000002
+CTIME: 5EC29457
 CLIENT: pmg-demo.proxmox.com[192.168.30.128]
-TO:5EC2B077:T5EC2B077L00000002:B: from <mailtestsender.bad@proxtest.com> to <ferdl@example.proxmox.com>
+TO:5EC29457:T5EC29457L00000002:B: from <mailtestsender.bad@proxtest.com> to <ferdl@example.proxmox.com>
 LOGS:
 L00000003 May 18 15:57:43 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
 L00000004 May 18 15:57:43 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
@@ -22,11 +22,11 @@ L0000000B May 18 15:57:43 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-ME
 L0000000C May 18 15:57:43 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
 
 QENTRY: 6B2CD3209E0
-CTIME: 5EC2B1EB
+CTIME: 5EC295CB
 SIZE: 2342
 CLIENT: localhost.localdomain[127.0.0.1],
 MSGID: <20200518140355.6B2CD3209E0@pmg-demo.proxmox.com>
-TO:5EC2B1EB:6B2CD3209E0:B: from <mailtestsender.good@proxtest.com> to <ferdl@example.proxmox.com> (none)
+TO:5EC295CB:6B2CD3209E0:B: from <mailtestsender.good@proxtest.com> to <ferdl@example.proxmox.com> (none)
 SMTP:
 L00000024 May 18 16:03:55 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
 L00000025 May 18 16:03:55 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
@@ -48,11 +48,11 @@ L00000033 May 18 16:03:55 pmg-demo postfix/smtp[17728]: 6B2CD3209E0: to=<office@
 L00000034 May 18 16:03:55 pmg-demo postfix/qmgr[1097]: 6B2CD3209E0: removed
 
 QENTRY: 264C33209E0
-CTIME: 5EC2B303
+CTIME: 5EC296E3
 SIZE: 2339
 CLIENT: localhost.localdomain[127.0.0.1],
 MSGID: <20200518140835.264C33209E0@pmg-demo.proxmox.com>
-TO:5EC2B303:264C33209E0:B: from <mailtestsender.good@proxtest.com> to <ferdl@example.proxmox.com> (none)
+TO:5EC296E3:264C33209E0:B: from <mailtestsender.good@proxtest.com> to <ferdl@example.proxmox.com> (none)
 SMTP:
 L00000037 May 18 16:08:34 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
 L00000038 May 18 16:08:34 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
@@ -74,11 +74,11 @@ L00000046 May 18 16:08:35 pmg-demo postfix/smtp[17728]: 264C33209E0: to=<ceo@exa
 L00000047 May 18 16:08:35 pmg-demo postfix/qmgr[1097]: 264C33209E0: removed
 
 QENTRY: 86D0C3209DE
-CTIME: 5EC2B344
+CTIME: 5EC29724
 SIZE: 2932
 CLIENT: localhost.localdomain[127.0.0.1],
 MSGID: <20200518140940.86D0C3209DE@pmg-demo.proxmox.com>
-TO:5EC2B344:86D0C3209DE:B: from <mailtestsender.good@proxtest.com> to <ferdl@example.proxmox.com> (none)
+TO:5EC29724:86D0C3209DE:B: from <mailtestsender.good@proxtest.com> to <ferdl@example.proxmox.com> (none)
 SMTP:
 L0000004A May 18 16:09:39 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
 L0000004B May 18 16:09:39 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
diff --git a/tests/test_output_time_rfc3339_mixed b/tests/test_output_time_rfc3339_mixed
index 3e628b8..5accb12 100644
--- a/tests/test_output_time_rfc3339_mixed
+++ b/tests/test_output_time_rfc3339_mixed
@@ -5,12 +5,12 @@
 # End Query Options
 
 QENTRY: 520C9C0192
-CTIME: 6495AB99
+CTIME: 64958F79
 SIZE: 1902
 CLIENT: pmghost.mydomain.tld[192.168.1.001]
 MSGID: <redacted:msgid>
-TO:6495AB99:520C9C0192:Q: from <redacted:returnpath@domain.tld> to <user@domain2.tld> (C01C264958F7962FEA)
-TO:6495AB99:520C9C0192:Q: from <redacted:returnpath@domain.tld> to <test@mydomain.tld> (C01C264958F7962FEA)
+TO:64958F79:520C9C0192:Q: from <redacted:returnpath@domain.tld> to <user@domain2.tld> (C01C264958F7962FEA)
+TO:64958F79:520C9C0192:Q: from <redacted:returnpath@domain.tld> to <test@mydomain.tld> (C01C264958F7962FEA)
 SMTP:
 L00000004 2023-06-23T14:26:29.331019+02:00 pmg1 postfix/smtpd[1181]: connect from pmghost.mydomain.tld[192.168.1.001]
 L00000005 2023-06-23T14:26:29.336189+02:00 pmg1 postfix/smtpd[1181]: 520C9C0192: client=pmghost.mydomain.tld[192.168.1.001]
@@ -29,12 +29,12 @@ L00000011 2023-06-23T14:26:33.461645+02:00 pmg1 postfix/lmtp[1186]: 520C9C0192:
 L00000012 2023-06-23T14:26:33.461834+02:00 pmg1 postfix/qmgr[1136]: 520C9C0192: removed
 
 QENTRY: 866B7C0192
-CTIME: 6495C7FD
+CTIME: 6495ABDD
 SIZE: 44585
 CLIENT: pmghost.mydomain.tld[192.168.1.001]
 MSGID: <redacted:msgid>
-TO:6495C7FD:866B7C0192:Q: from <redacted:returnpath@domain.tld> to <user@domain2.tld> (C01C364958FBD55D53)
-TO:6495C7FD:866B7C0192:Q: from <redacted:returnpath@domain.tld> to <test@mydomain.tld> (C01C364958FBD55D53)
+TO:6495ABDD:866B7C0192:Q: from <redacted:returnpath@domain.tld> to <user@domain2.tld> (C01C364958FBD55D53)
+TO:6495ABDD:866B7C0192:Q: from <redacted:returnpath@domain.tld> to <test@mydomain.tld> (C01C364958FBD55D53)
 SMTP:
 L00000019 2023-06-23T14:27:40.550478Z pmg1 postfix/smtpd[1181]: connect from pmghost.mydomain.tld[192.168.1.001]
 L0000001A 2023-06-23T14:27:40.550799Z pmg1 postfix/smtpd[1181]: 866B7C0192: client=pmghost.mydomain.tld[192.168.1.001]
@@ -53,12 +53,12 @@ L00000026 2023-06-23T14:27:41.429627Z pmg1 postfix/lmtp[1186]: 866B7C0192: to=<u
 L00000027 2023-06-23T14:27:41.429803Z pmg1 postfix/qmgr[1136]: 866B7C0192: removed
 
 QENTRY: C4EC9C0192
-CTIME: 6495E44A
+CTIME: 6495C82A
 SIZE: 130922
 CLIENT: pmghost.mydomain.tld[192.168.1.001]
 MSGID: <redacted:msgid>
-TO:6495E44A:C4EC9C0192:Q: from <redacted:returnpath@domain.tld> to <user@domain2.tld> (C01D364958FEA2A254)
-TO:6495E44A:C4EC9C0192:Q: from <redacted:returnpath@domain.tld> to <test@mydomain.tld> (C01D364958FEA2A254)
+TO:6495C82A:C4EC9C0192:Q: from <redacted:returnpath@domain.tld> to <user@domain2.tld> (C01D364958FEA2A254)
+TO:6495C82A:C4EC9C0192:Q: from <redacted:returnpath@domain.tld> to <test@mydomain.tld> (C01D364958FEA2A254)
 SMTP:
 L0000002C 2023-06-23T14:28:23.806586-02:00 pmg1 postfix/smtpd[1181]: connect from pmghost.mydomain.tld[192.168.1.001]
 L0000002D 2023-06-23T14:28:23.806755-02:00 pmg1 postfix/smtpd[1181]: C4EC9C0192: client=pmghost.mydomain.tld[192.168.1.001]
@@ -77,11 +77,11 @@ L00000038 2023-06-23T14:28:26.241632-02:00 pmg1 postfix/lmtp[1186]: C4EC9C0192:
 L00000039 2023-06-23T14:28:26.242140-02:00 pmg1 postfix/qmgr[1136]: C4EC9C0192: removed
 
 QENTRY: 71386C0192
-CTIME: 6495E461
+CTIME: 6495C841
 SIZE: 129347
 CLIENT: localhost.localdomain[127.0.0.1]
 MSGID: <redacted:msgid>
-TO:6495E461:71386C0192:2: from <postmaster@pmghost.mydomain.tld> to <user@domain2.tld> (relay.domain3.tld[192.168.1.002]:25)
+TO:6495C841:71386C0192:2: from <postmaster@pmghost.mydomain.tld> to <user@domain2.tld> (relay.domain3.tld[192.168.1.002]:25)
 SMTP:
 L0000003C 2023-06-23T14:28:42.463301-02:00 pmg1 postfix/smtpd[1274]: connect from localhost.localdomain[127.0.0.1]
 L0000003D 2023-06-23T14:28:42.463813-02:00 pmg1 postfix/smtpd[1274]: 71386C0192: client=localhost.localdomain[127.0.0.1]
diff --git a/tests/test_output_timechange b/tests/test_output_timechange
index 1c19799..2137bf4 100644
--- a/tests/test_output_timechange
+++ b/tests/test_output_timechange
@@ -5,11 +5,11 @@
 # End Query Options
 
 QENTRY: 3AA60B752
-CTIME: 5E7EAE04
+CTIME: 5E7E9FF4
 SIZE: 5935
 CLIENT: bbs.domain.example[192.0.2.245]
 MSGID: <57213b21fafd7b52a6e07ef664c7e8a4@bbs.domain.example>
-TO:5E7EAE01:3AA60B752:A: from <office@domain.example> to <tb@msp1.example> (48070B766)
+TO:5E7E9FF1:3AA60B752:A: from <office@domain.example> to <tb@msp1.example> (48070B766)
 SMTP:
 L00000006 Mar 28 01:53:05 proxmox-pmg postfix/smtpd[23385]: connect from bbs.domain.example[192.0.2.245]
 L00000007 Mar 28 01:53:05 proxmox-pmg postfix/smtpd[23385]: 3AA60B752: client=bbs.domain.example[192.0.2.245]
@@ -25,11 +25,11 @@ L00000014 Mar 28 01:53:05 proxmox-pmg postfix/lmtp[23389]: 3AA60B752: to=<tb@msp
 L00000015 Mar 28 01:53:05 proxmox-pmg postfix/qmgr[570]: 3AA60B752: removed
 
 QENTRY: 48070B766
-CTIME: 5E7EAE04
+CTIME: 5E7E9FF4
 SIZE: 5816
 CLIENT: localhost[127.0.0.1],
 MSGID: <57213b21fafd7b52a6e07ef664c7e8a4@bbs.domain.example>
-TO:5E7EAE04:48070B766:2: from <office@domain.example> to <tb@msp1.example> (mta6.msp1.example[192.0.2.72]:25)
+TO:5E7E9FF4:48070B766:2: from <office@domain.example> to <tb@msp1.example> (mta6.msp1.example[192.0.2.72]:25)
 SMTP:
 L0000000D Mar 28 01:53:05 proxmox-pmg postfix/smtpd[23393]: connect from localhost[127.0.0.1]
 L0000000E Mar 28 01:53:05 proxmox-pmg postfix/smtpd[23393]: 48070B766: client=localhost[127.0.0.1], orig_client=bbs.domain.example[192.0.2.245]
@@ -42,12 +42,12 @@ L00000017 Mar 28 01:53:08 proxmox-pmg postfix/smtp[23394]: 48070B766: to=<tb@msp
 L00000018 Mar 28 01:53:08 proxmox-pmg postfix/qmgr[570]: 48070B766: removed
 
 QENTRY: B76CCB76D
-CTIME: 5E7EBF8B
+CTIME: 5E7EB17B
 SIZE: 136634
 CLIENT: backoffice.domain2.example[192.0.2.249]
 MSGID: <7nwfURRJWcDhR89oZjv9eCy7YKOpCFfXDGTDMakN0k@backoffice.domain2.example>
-TO:5E7EBF84:B76CCB76D:A: from <office@domain2.example> to <ext1@external1.example> (CF907B795)
-TO:5E7EBF84:B76CCB76D:A: from <office@domain2.example> to <backoffice@domain2.example> (CF907B795)
+TO:5E7EB174:B76CCB76D:A: from <office@domain2.example> to <ext1@external1.example> (CF907B795)
+TO:5E7EB174:B76CCB76D:A: from <office@domain2.example> to <backoffice@domain2.example> (CF907B795)
 SMTP:
 L00000025 Mar 28 03:07:48 proxmox-pmg postfix/smtpd[23509]: connect from backoffice.domain2.example[192.0.2.249]
 L00000026 Mar 28 03:07:48 proxmox-pmg postfix/smtpd[23509]: B76CCB76D: client=backoffice.domain2.example[192.0.2.249]
@@ -65,12 +65,12 @@ L00000035 Mar 28 03:07:48 proxmox-pmg postfix/lmtp[23513]: B76CCB76D: to=<ext1@e
 L00000036 Mar 28 03:07:48 proxmox-pmg postfix/qmgr[570]: B76CCB76D: removed
 
 QENTRY: CF907B795
-CTIME: 5E7EBF8B
+CTIME: 5E7EB17B
 SIZE: 136511
 CLIENT: localhost[127.0.0.1],
 MSGID: <7nwfURRJWcDhR89oZjv9eCy7YKOpCFfXDGTDMakN0k@backoffice.domain2.example>
-TO:5E7EBF8B:CF907B795:2: from <office@domain2.example> to <ext1@external1.example> (smtp.external1.example[192.0.2.51]:25)
-TO:5E7EBF86:CF907B795:2: from <office@domain2.example> to <backoffice@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
+TO:5E7EB17B:CF907B795:2: from <office@domain2.example> to <ext1@external1.example> (smtp.external1.example[192.0.2.51]:25)
+TO:5E7EB176:CF907B795:2: from <office@domain2.example> to <backoffice@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
 SMTP:
 L0000002C Mar 28 03:07:48 proxmox-pmg postfix/smtpd[23517]: connect from localhost[127.0.0.1]
 L0000002D Mar 28 03:07:48 proxmox-pmg postfix/smtpd[23517]: CF907B795: client=localhost[127.0.0.1], orig_client=backoffice.domain2.example[192.0.2.249]
@@ -84,28 +84,28 @@ L00000039 Mar 28 03:07:55 proxmox-pmg postfix/smtp[23519]: Trusted TLS connectio
 L0000003A Mar 28 03:07:55 proxmox-pmg postfix/smtp[23519]: CF907B795: to=<ext1@external1.example>, relay=smtp.external1.example[192.0.2.51]:25, delay=6.6, delays=0.01/0.03/6.3/0.33, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 61FE04093ED0)
 L0000003B Mar 28 03:07:55 proxmox-pmg postfix/qmgr[570]: CF907B795: removed
 
-SMTPD: T5F9CC8B2L00000000
-CTIME: 5F9CC8B2
+SMTPD: T5F9CBAA2L00000000
+CTIME: 5F9CBAA2
 CLIENT: 192.0.2.213
-TO:5F9CC8B2:T5F9CC8B2L00000000:N: from <contact@spammer1.example> to <list1@listserv.domain.example>
+TO:5F9CBAA2:T5F9CBAA2L00000000:N: from <contact@spammer1.example> to <list1@listserv.domain.example>
 LOGS:
 L0000005C Oct 31 02:15:14 proxmox-pmg postfix/postscreen[6185]: NOQUEUE: reject: RCPT from [192.0.2.213]:12641: 550 5.7.1 Service unavailable; client [192.0.2.213] blocked using zen.spamhaus.org; from=<contact@spammer1.example>, to=<list1@listserv.domain.example>, proto=ESMTP, helo=<spammer1.example>
 
-SMTPD: T5F9CCB56L00000001
-CTIME: 5F9CCB57
+SMTPD: T5F9CBD46L00000001
+CTIME: 5F9CBD47
 CLIENT: unknown[192.0.2.214]
-TO:5F9CCB56:T5F9CCB56L00000001:G: from <product1@spammer2.example> to <list1@listserv.domain.example>
+TO:5F9CBD46:T5F9CBD46L00000001:G: from <product1@spammer2.example> to <list1@listserv.domain.example>
 LOGS:
 L00000061 Oct 31 02:26:30 proxmox-pmg postfix/smtpd[6264]: connect from unknown[192.0.2.214]
 L00000064 Oct 31 02:26:30 proxmox-pmg postfix/smtpd[6264]: NOQUEUE: reject: RCPT from unknown[192.0.2.214]: 450 4.7.1 <list1@listserv.domain.example>: Recipient address rejected: Service is unavailable (try later); from=<product1@spammer2.example> to=<list1@listserv.domain.example> proto=ESMTP helo=<spammer2.example>
 L00000065 Oct 31 02:26:31 proxmox-pmg postfix/smtpd[6264]: disconnect from unknown[192.0.2.214] ehlo=1 mail=1 rcpt=0/1 data=0/1 quit=1 commands=3/5
 
 QENTRY: 7EC601A15F
-CTIME: 5F9CD1B3
+CTIME: 5F9CC3A3
 SIZE: 11013
 CLIENT: bbs.domain.example[192.0.2.245]
 MSGID: <ac1e470c93dbecffeda550e0c96da154@bbs.domain.example>
-TO:5F9CD1B2:7EC601A15F:A: from <office@domain.example> to <ks@msp2.example> (8D0041A173)
+TO:5F9CC3A2:7EC601A15F:A: from <office@domain.example> to <ks@msp2.example> (8D0041A173)
 SMTP:
 L0000006E Oct 31 02:53:38 proxmox-pmg postfix/smtpd[6006]: connect from bbs.domain.example[192.0.2.245]
 L0000006F Oct 31 02:53:38 proxmox-pmg postfix/smtpd[6006]: 7EC601A15F: client=bbs.domain.example[192.0.2.245]
@@ -121,11 +121,11 @@ L0000007C Oct 31 02:53:38 proxmox-pmg postfix/lmtp[6008]: 7EC601A15F: to=<ks@msp
 L0000007D Oct 31 02:53:38 proxmox-pmg postfix/qmgr[567]: 7EC601A15F: removed
 
 QENTRY: 8D0041A173
-CTIME: 5F9CD1B3
+CTIME: 5F9CC3A3
 SIZE: 10893
 CLIENT: localhost[127.0.0.1],
 MSGID: <ac1e470c93dbecffeda550e0c96da154@bbs.domain.example>
-TO:5F9CD1B3:8D0041A173:2: from <office@domain.example> to <ks@msp2.example> (mx-in.msp2.example[2001:db8:1111:1111::1b]:25)
+TO:5F9CC3A3:8D0041A173:2: from <office@domain.example> to <ks@msp2.example> (mx-in.msp2.example[2001:db8:1111:1111::1b]:25)
 SMTP:
 L00000075 Oct 31 02:53:38 proxmox-pmg postfix/smtpd[6012]: connect from localhost[127.0.0.1]
 L00000076 Oct 31 02:53:38 proxmox-pmg postfix/smtpd[6012]: 8D0041A173: client=localhost[127.0.0.1], orig_client=bbs.domain.example[192.0.2.245]
@@ -138,11 +138,11 @@ L0000007F Oct 31 02:53:39 proxmox-pmg postfix/smtp[6013]: 8D0041A173: to=<ks@msp
 L00000080 Oct 31 02:53:39 proxmox-pmg postfix/qmgr[567]: 8D0041A173: removed
 
 QENTRY: 44A0B1A1BB
-CTIME: 5F9CC530
+CTIME: 5F9CB720
 SIZE: 28128
 CLIENT: www.domain.example[192.0.2.69]
 MSGID: <NTI1OTkyMAAC20549Y5BAMTYzNTY0MjAxMjcyMDg4@www.domain.example>
-TO:5F9CC52C:44A0B1A1BB:A: from <news@domain.example> to <mbox1@domain.example> (53EF81A1CD)
+TO:5F9CB71C:44A0B1A1BB:A: from <news@domain.example> to <mbox1@domain.example> (53EF81A1CD)
 SMTP:
 L0000008E Oct 31 02:00:12 proxmox-pmg postfix/smtpd[6520]: connect from www.domain.example[192.0.2.69]
 L0000008F Oct 31 02:00:12 proxmox-pmg postfix/smtpd[6520]: 44A0B1A1BB: client=www.domain.example[192.0.2.69]
@@ -158,11 +158,11 @@ L0000009C Oct 31 02:00:12 proxmox-pmg postfix/lmtp[6523]: 44A0B1A1BB: to=<mbox1@
 L0000009D Oct 31 02:00:12 proxmox-pmg postfix/qmgr[567]: 44A0B1A1BB: removed
 
 QENTRY: 53EF81A1CD
-CTIME: 5F9CC530
+CTIME: 5F9CB720
 SIZE: 28014
 CLIENT: localhost[127.0.0.1],
 MSGID: <NTI1OTkyMAAC20549Y5BAMTYzNTY0MjAxMjcyMDg4@www.domain.example>
-TO:5F9CC530:53EF81A1CD:2: from <news@domain.example> to <mbox1@domain.example> (mail.domain.example[192.0.2.106]:25)
+TO:5F9CB720:53EF81A1CD:2: from <news@domain.example> to <mbox1@domain.example> (mail.domain.example[192.0.2.106]:25)
 SMTP:
 L00000095 Oct 31 02:00:12 proxmox-pmg postfix/smtpd[6527]: connect from localhost[127.0.0.1]
 L00000096 Oct 31 02:00:12 proxmox-pmg postfix/smtpd[6527]: 53EF81A1CD: client=localhost[127.0.0.1], orig_client=www.domain.example[192.0.2.69]
@@ -174,21 +174,21 @@ L0000009E Oct 31 02:00:12 proxmox-pmg postfix/smtp[6512]: Trusted TLS connection
 L0000009F Oct 31 02:00:16 proxmox-pmg postfix/smtp[6512]: 53EF81A1CD: to=<mbox1@domain.example>, relay=mail.domain.example[192.0.2.106]:25, delay=4.2, delays=0/0/0.34/3.9, dsn=2.5.0, status=sent (250 2.5.0 OK (448AE617DEA9CB1BE8))
 L000000A0 Oct 31 02:00:16 proxmox-pmg postfix/qmgr[567]: 53EF81A1CD: removed
 
-SMTPD: T5F9CC5D0L00000000
-CTIME: 5F9CC5D1
+SMTPD: T5F9CB7C0L00000000
+CTIME: 5F9CB7C1
 CLIENT: unknown[192.0.2.215]
-TO:5F9CC5D1:T5F9CC5D0L00000000:G: from <product2@spammer3.example> to <list1@listserv.domain.example>
+TO:5F9CB7C1:T5F9CB7C0L00000000:G: from <product2@spammer3.example> to <list1@listserv.domain.example>
 LOGS:
 L000000A9 Oct 31 02:02:56 proxmox-pmg postfix/smtpd[6548]: connect from unknown[192.0.2.215]
 L000000AB Oct 31 02:02:57 proxmox-pmg postfix/smtpd[6548]: NOQUEUE: reject: RCPT from unknown[192.0.2.215]: 450 4.7.1 <list1@listserv.domain.example>: Recipient address rejected: Service is unavailable (try later); from=<product2@spammer3.example> to=<list1@listserv.domain.example> proto=ESMTP helo=<spammer3.example>
 L000000AC Oct 31 02:02:57 proxmox-pmg postfix/smtpd[6548]: disconnect from unknown[192.0.2.215] ehlo=1 mail=1 rcpt=0/1 data=0/1 quit=1 commands=3/5
 
 QENTRY: BBA631A1D1
-CTIME: 5F9CC653
+CTIME: 5F9CB843
 SIZE: 10843
 CLIENT: bbs.domain.example[192.0.2.245]
 MSGID: <ff48fa12236e379e1a34cd6f50430922@bbs.domain.example>
-TO:5F9CC652:BBA631A1D1:A: from <office@domain.example> to <jw@msp3.example> (C9D5E1A1E6)
+TO:5F9CB842:BBA631A1D1:A: from <office@domain.example> to <jw@msp3.example> (C9D5E1A1E6)
 SMTP:
 L000000B1 Oct 31 02:05:06 proxmox-pmg postfix/smtpd[6570]: connect from bbs.domain.example[192.0.2.245]
 L000000B2 Oct 31 02:05:06 proxmox-pmg postfix/smtpd[6570]: BBA631A1D1: client=bbs.domain.example[192.0.2.245]
@@ -204,11 +204,11 @@ L000000BF Oct 31 02:05:06 proxmox-pmg postfix/lmtp[6573]: BBA631A1D1: to=<jw@msp
 L000000C0 Oct 31 02:05:06 proxmox-pmg postfix/qmgr[567]: BBA631A1D1: removed
 
 QENTRY: C9D5E1A1E6
-CTIME: 5F9CC653
+CTIME: 5F9CB843
 SIZE: 10724
 CLIENT: localhost[127.0.0.1],
 MSGID: <ff48fa12236e379e1a34cd6f50430922@bbs.domain.example>
-TO:5F9CC653:C9D5E1A1E6:2: from <office@domain.example> to <jw@msp3.example> (mx-in.msp2.example[2001:db8:1111:1111::1a]:25)
+TO:5F9CB843:C9D5E1A1E6:2: from <office@domain.example> to <jw@msp3.example> (mx-in.msp2.example[2001:db8:1111:1111::1a]:25)
 SMTP:
 L000000B8 Oct 31 02:05:06 proxmox-pmg postfix/smtpd[6577]: connect from localhost[127.0.0.1]
 L000000B9 Oct 31 02:05:06 proxmox-pmg postfix/smtpd[6577]: C9D5E1A1E6: client=localhost[127.0.0.1], orig_client=bbs.domain.example[192.0.2.245]
@@ -221,22 +221,22 @@ L000000C2 Oct 31 02:05:07 proxmox-pmg postfix/smtp[6578]: C9D5E1A1E6: to=<jw@msp
 L000000C3 Oct 31 02:05:07 proxmox-pmg postfix/qmgr[567]: C9D5E1A1E6: removed
 
 QENTRY: 3C2EE26E95
-CTIME: 5FEE65FF
+CTIME: 5FEE57EF
 SIZE: 0
 QMGR:
 L000000CD Dec 31 23:59:59 proxmox-pmg postfix/qmgr[567]: 3C2EE26E95: removed
 
 QENTRY: 42EA826EA2
-CTIME: 5FEE65FF
+CTIME: 5FEE57EF
 SIZE: 10334
 CLIENT: backoffice.domain.example[192.0.2.249]
 MSGID: <LpNdZDCBBeeogzOLgHlkvs93WqJU4ZLlol8UCBOYmY@backoffice.domain.example>
-TO:5FEE65FF:42EA826EA2:A: from <noreply@domain.example> to <mbox5@domain.example> (51BD826EBE)
-TO:5FEE65FF:42EA826EA2:A: from <noreply@domain.example> to <backoffice@domain2.example> (51BD826EBE)
-TO:5FEE65FF:42EA826EA2:A: from <noreply@domain.example> to <backoffice@domain2.example> (51BD826EBE)
-TO:5FEE65FF:42EA826EA2:A: from <noreply@domain.example> to <mbox4@domain2.example> (51BD826EBE)
-TO:5FEE65FF:42EA826EA2:A: from <noreply@domain.example> to <mbox2@domain2.example> (51BD826EBE)
-TO:5FEE65FF:42EA826EA2:A: from <noreply@domain.example> to <mbox3@domain2.example> (51BD826EBE)
+TO:5FEE57EF:42EA826EA2:A: from <noreply@domain.example> to <mbox5@domain.example> (51BD826EBE)
+TO:5FEE57EF:42EA826EA2:A: from <noreply@domain.example> to <backoffice@domain2.example> (51BD826EBE)
+TO:5FEE57EF:42EA826EA2:A: from <noreply@domain.example> to <backoffice@domain2.example> (51BD826EBE)
+TO:5FEE57EF:42EA826EA2:A: from <noreply@domain.example> to <mbox4@domain2.example> (51BD826EBE)
+TO:5FEE57EF:42EA826EA2:A: from <noreply@domain.example> to <mbox2@domain2.example> (51BD826EBE)
+TO:5FEE57EF:42EA826EA2:A: from <noreply@domain.example> to <mbox3@domain2.example> (51BD826EBE)
 SMTP:
 L000000C5 Dec 31 23:59:59 proxmox-pmg postfix/smtpd[26384]: connect from backoffice.domain.example[192.0.2.249]
 L000000C6 Dec 31 23:59:59 proxmox-pmg postfix/smtpd[26384]: 42EA826EA2: client=backoffice.domain.example[192.0.2.249]
@@ -262,15 +262,15 @@ L000000DF Dec 31 23:59:59 proxmox-pmg postfix/lmtp[26389]: 42EA826EA2: to=<mbox5
 L000000E0 Dec 31 23:59:59 proxmox-pmg postfix/qmgr[567]: 42EA826EA2: removed
 
 QENTRY: 51BD826EBE
-CTIME: 5FEE65FF
+CTIME: 5FEE57EF
 SIZE: 10218
 CLIENT: localhost[127.0.0.1],
 MSGID: <LpNdZDCBBeeogzOLgHlkvs93WqJU4ZLlol8UCBOYmY@backoffice.domain.example>
-TO:5FEE65FF:51BD826EBE:2: from <noreply@domain.example> to <backoffice@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
-TO:5FEE65FF:51BD826EBE:2: from <noreply@domain.example> to <mbox4@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
-TO:5FEE65FF:51BD826EBE:2: from <noreply@domain.example> to <mbox2@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
-TO:5FEE65FF:51BD826EBE:2: from <noreply@domain.example> to <mbox3@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
-TO:5FEE65FF:51BD826EBE:2: from <noreply@domain.example> to <mbox5@domain.example> (mail.domain.example[192.0.2.106]:25)
+TO:5FEE57EF:51BD826EBE:2: from <noreply@domain.example> to <backoffice@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
+TO:5FEE57EF:51BD826EBE:2: from <noreply@domain.example> to <mbox4@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
+TO:5FEE57EF:51BD826EBE:2: from <noreply@domain.example> to <mbox2@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
+TO:5FEE57EF:51BD826EBE:2: from <noreply@domain.example> to <mbox3@domain2.example> (smtp.domain2.example[192.0.2.180]:25)
+TO:5FEE57EF:51BD826EBE:2: from <noreply@domain.example> to <mbox5@domain.example> (mail.domain.example[192.0.2.106]:25)
 SMTP:
 L000000CE Dec 31 23:59:59 proxmox-pmg postfix/smtpd[26398]: connect from localhost[127.0.0.1]
 L000000CF Dec 31 23:59:59 proxmox-pmg postfix/smtpd[26398]: 51BD826EBE: client=localhost[127.0.0.1], orig_client=backoffice.domain.example[192.0.2.249]
@@ -287,8 +287,8 @@ L000000E7 Dec 31 23:59:59 proxmox-pmg postfix/smtp[26403]: 51BD826EBE: to=<mbox4
 L000000E8 Dec 31 23:59:59 proxmox-pmg postfix/smtp[26403]: 51BD826EBE: to=<backoffice@domain2.example>, relay=smtp.domain2.example[192.0.2.180]:25, delay=1.2, delays=0.05/0/0.22/0.89, dsn=2.5.0, status=sent (250 2.5.0 OK (46BE861CF83FDA43DE))
 L000000E9 Dec 31 23:59:59 proxmox-pmg postfix/qmgr[567]: 51BD826EBE: removed
 
-SMTPD: T5FEE65FFL00000001
-CTIME: 5FEE65FF
+SMTPD: T5FEE57EFL00000001
+CTIME: 5FEE57EF
 CLIENT: localhost[127.0.0.1]
 LOGS:
 L000000CC Dec 31 23:59:59 proxmox-pmg postfix/smtpd[26400]: connect from localhost[127.0.0.1]
-- 
2.39.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] [PATCH v3 pmg-log-tracker 4/5] cleanup: remove unused strftime function
  2024-02-20 10:06 [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Mira Limbeck
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 2/5] tests: improve test output consistency Mira Limbeck
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 3/5] tests: update for log tracker time handling changes Mira Limbeck
@ 2024-02-20 10:06 ` Mira Limbeck
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 5/5] cleanup: fix clippy warnings Mira Limbeck
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Mira Limbeck @ 2024-02-20 10:06 UTC (permalink / raw)
  To: pmg-devel

since we switched to proxmox_time::strftime_local for printing the start
and end times using local time, the strftime functions in src/time.rs is
unused and can be removed

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
cleanup commit that depends on patch 1/5, only apply if patch 1/5 is
applied.

v3:
 - unchanged

 src/time.rs | 31 -------------------------------
 1 file changed, 31 deletions(-)

diff --git a/src/time.rs b/src/time.rs
index 9a2ce73..d26dccd 100644
--- a/src/time.rs
+++ b/src/time.rs
@@ -59,13 +59,6 @@ impl fmt::Debug for Tm {
 /// These are now exposed via `libc`, but they're part of glibc.
 mod imports {
     extern "C" {
-        pub fn strftime(
-            s: *mut libc::c_char,
-            max: libc::size_t,
-            format: *const libc::c_char,
-            tm: *const libc::tm,
-        ) -> libc::size_t;
-
         pub fn strptime(
             s: *const libc::c_char,
             format: *const libc::c_char,
@@ -123,30 +116,6 @@ impl Tm {
     }
 }
 
-/// Wrapper around `strftime(3)` to format time strings.
-pub fn strftime(format: &CStr, tm: &Tm) -> Result<String, Error> {
-    let mut buf = MaybeUninit::<[u8; 64]>::uninit();
-
-    let size = unsafe {
-        imports::strftime(
-            buf.as_mut_ptr() as *mut libc::c_char,
-            64,
-            format.as_ptr(),
-            &tm.0,
-        )
-    };
-    if size == 0 {
-        bail!("failed to format time");
-    }
-    let size = size as usize;
-
-    let buf = unsafe { buf.assume_init() };
-
-    std::str::from_utf8(&buf[..size])
-        .map_err(|_| format_err!("formatted time was not valid utf-8"))
-        .map(str::to_string)
-}
-
 /// Wrapper around `strptime(3)` to parse time strings.
 pub fn strptime(time: &str, format: &CStr) -> Result<Tm, Error> {
     // zero memory because strptime does not necessarily initialize tm_isdst, tm_gmtoff and tm_zone
-- 
2.39.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] [PATCH v3 pmg-log-tracker 5/5] cleanup: fix clippy warnings
  2024-02-20 10:06 [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Mira Limbeck
                   ` (2 preceding siblings ...)
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 4/5] cleanup: remove unused strftime function Mira Limbeck
@ 2024-02-20 10:06 ` Mira Limbeck
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-api] MailTracker: remove timezone offset Mira Limbeck
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Mira Limbeck @ 2024-02-20 10:06 UTC (permalink / raw)
  To: pmg-devel

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
v3:
 - added `pmg-log-tracker` to subject

 src/main.rs | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 5d4f86e..0a4f192 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -748,8 +748,9 @@ impl Default for ToEntry {
     }
 }
 
-#[derive(Debug, PartialEq, Copy, Clone)]
+#[derive(Debug, PartialEq, Copy, Clone, Default)]
 enum DStatus {
+    #[default]
     Invalid,
     Accept,
     Quarantine,
@@ -762,12 +763,6 @@ enum DStatus {
     Dsn(u32),
 }
 
-impl Default for DStatus {
-    fn default() -> Self {
-        DStatus::Invalid
-    }
-}
-
 impl std::fmt::Display for DStatus {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         let c = match self {
@@ -1314,6 +1309,7 @@ impl QEntry {
         true
     }
 
+    #[allow(clippy::wrong_self_convention)]
     fn from_to_matches(&mut self, parser: &Parser) -> bool {
         if !parser.options.from.is_empty() {
             if self.from.is_empty() {
@@ -2368,7 +2364,7 @@ fn parse_host_service_pid(data: &[u8]) -> Option<(ByteSlice, ByteSlice, u64, Byt
         .count();
     let service = &data[0..service_count];
     let data = &data[service_count..];
-    if data.get(0) != Some(&b'[') {
+    if data.first() != Some(&b'[') {
         return None;
     }
     let data = &data[1..];
-- 
2.39.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] [PATCH v3 pmg-api] MailTracker: remove timezone offset
  2024-02-20 10:06 [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Mira Limbeck
                   ` (3 preceding siblings ...)
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 5/5] cleanup: fix clippy warnings Mira Limbeck
@ 2024-02-20 10:06 ` Mira Limbeck
  2024-02-22 12:25 ` [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Dominik Csapak
  2024-02-27 14:07 ` [pmg-devel] applied-series: " Thomas Lamprecht
  6 siblings, 0 replies; 8+ messages in thread
From: Mira Limbeck @ 2024-02-20 10:06 UTC (permalink / raw)
  To: pmg-devel

The timezone offset is moved to `pmg-log-tracker` in the
compatibility code path. This way the new rfc3339 timestamp, which is
already in UTC, can be used as is.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
v3:
 - no changes

v2:
 - no changes


 src/PMG/API2/MailTracker.pm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/PMG/API2/MailTracker.pm b/src/PMG/API2/MailTracker.pm
index b8b25ad..ffda4b5 100644
--- a/src/PMG/API2/MailTracker.pm
+++ b/src/PMG/API2/MailTracker.pm
@@ -43,8 +43,6 @@ my $run_pmg_log_tracker = sub {
 
     my $logids = {};
 
-    my $timezone = tz_local_offset();;
-
     if (defined(my $id = $includelog)) {
 	if ($id =~ m/^Q([a-f0-9]+)R([a-f0-9]+)$/i) {
 	    $logids->{$1} = 1;
@@ -128,7 +126,7 @@ my $run_pmg_log_tracker = sub {
 	    } elsif ($line =~ m/^TO:([0-9A-F]+):([0-9A-F]+):([0-9A-Z]):\s+from <([^>]*)>\s+to\s+<([^>]+)>\s+\((\S+)\)$/) {
 		my $new = {
 		    size => $entry->{size} // 0,
-		    time => hex($1) - $timezone,
+		    time => hex($1),
 		    qid => $2,
 		    dstatus => $3,
 		    from => $4,
@@ -174,7 +172,7 @@ my $run_pmg_log_tracker = sub {
 	    } elsif ($line =~ m/^TO:([0-9A-F]+):(T[0-9A-F]+L[0-9A-F]+):([0-9A-Z]):\s+from <([^>]*)>\s+to\s+<([^>]*)>$/) {
 		my $e = {};
 		$e->{client} = $entry->{client} if defined($entry->{client});
-		$e->{time} = hex($1) - $timezone;
+		$e->{time} = hex($1);
 		$e->{id} = $2;
 		$e->{dstatus} = $3;
 		$e->{from} = $4;
-- 
2.39.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser
  2024-02-20 10:06 [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Mira Limbeck
                   ` (4 preceding siblings ...)
  2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-api] MailTracker: remove timezone offset Mira Limbeck
@ 2024-02-22 12:25 ` Dominik Csapak
  2024-02-27 14:07 ` [pmg-devel] applied-series: " Thomas Lamprecht
  6 siblings, 0 replies; 8+ messages in thread
From: Dominik Csapak @ 2024-02-22 12:25 UTC (permalink / raw)
  To: Mira Limbeck, pmg-devel

Gave this series a look & spin

code wise looks good imho

as mentioned off-list, we could fix the issue of the endtimes' offset
by adding the difference of offset of the end/start to the end cutoff
iff we encounter lines in the old format
(i.e. if the starttime was +1 and the endtime was +2, we have to
subtract +2 - +1 = 1 from the endtime for the old log format)

but that should not make too much difference in practice, as the
old log format was broken anyway in some circumstances

all in all i think this change is a net positive, since the time
returned by the log-tracker is now the "real" unix epoch
and we can drop the local timezone offset when we have the exact time
(which is most of the time now for current installations)

we probably should mention that the non exactly syslog format is
deprecated though and can create problems/confusion in the log tracker

tested with my local logs (no old format left sadly) and played around
with the test cases with the old format and found no issues

(how i hate handling time(zones) manually :P )




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [pmg-devel] applied-series: [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser
  2024-02-20 10:06 [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Mira Limbeck
                   ` (5 preceding siblings ...)
  2024-02-22 12:25 ` [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Dominik Csapak
@ 2024-02-27 14:07 ` Thomas Lamprecht
  6 siblings, 0 replies; 8+ messages in thread
From: Thomas Lamprecht @ 2024-02-27 14:07 UTC (permalink / raw)
  To: Mira Limbeck, pmg-devel

Am 20/02/2024 um 11:06 schrieb Mira Limbeck:
> The compatibility code was added to the new rfc3339 code path temporarily so
> that the old code path would not be changed before the PMG 8 release.
> 
> Now move it to the old time format code to make sure the rfc3339 code path
> works as expected. Since we have all the information we need (year, month,
> day, hours, minutes, seconds, timezone), there's no need for a workaround in
> this code path.
> 
> As a side effect of parsing the time format `YYYY-MM-DD HH:MM:SS` in
> localtime, it's now possible to parse an rfc3339 compliant format
> (except for fractional seconds).
> 
> The change needs to be accompanied by one in pmg-api MailTracker.pmg to
> keep the time displayed in the GUI the same for the old time format, and
> correct for the new rfc3339 format.
> 
> Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
> ---
> I've tested it locally with both old timestamp format and new one, but
> running it on more logs would not hurt
> 
> Since we use only the start time to calculate the timezone offset, it
> will not be reliable in all cases, especially when the end time offset
> differs from the start time.
> 
> v3:
>  - changed file in range of start/end time check to use the start time
>    timezone offset, which allowed us to remove the timezone_offset
>    member of the parser struct
> 
> v2:
>  - removed TODO line
>  - fixed start-/endtime offset mentioned by @stoiko on the rfc
>  - added rfc3339 start-/endtime handling as suggested by @dominik since
>    it eases parsing the YYYY-MM-DD HH:MM:SS format as localtime rather
>    than UTC
>  - added tests in another patch
> 
>  src/main.rs | 65 ++++++++++++++++++++++++++++++-----------------------
>  src/time.rs | 23 ++++++++++++++++++-
>  2 files changed, 59 insertions(+), 29 deletions(-)
> 
>

For the record, this series has been applied yesterday by Stoiko, thanks!




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-27 14:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 10:06 [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Mira Limbeck
2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 2/5] tests: improve test output consistency Mira Limbeck
2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 3/5] tests: update for log tracker time handling changes Mira Limbeck
2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 4/5] cleanup: remove unused strftime function Mira Limbeck
2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-log-tracker 5/5] cleanup: fix clippy warnings Mira Limbeck
2024-02-20 10:06 ` [pmg-devel] [PATCH v3 pmg-api] MailTracker: remove timezone offset Mira Limbeck
2024-02-22 12:25 ` [pmg-devel] [PATCH v3 pmg-log-tracker 1/5] rfc3339: move timezone offset compatibility code to old time parser Dominik Csapak
2024-02-27 14:07 ` [pmg-devel] applied-series: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal