From 5af23fe3cc300d8bfb6193915c8f1032094dad4d Mon Sep 17 00:00:00 2001 From: Alexander Garustovich Date: Mon, 2 Mar 2026 12:48:48 +0300 Subject: [PATCH 1/2] [generic_log] support nanosecond-precision timestamps --- src/log_format_impls.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/log_format_impls.cc b/src/log_format_impls.cc index 1923124f6c..0a52fc35f5 100644 --- a/src/log_format_impls.cc +++ b/src/log_format_impls.cc @@ -148,7 +148,7 @@ class generic_log_format : public log_format { static const pcre_format log_fmt[] = { pcre_format(R"(^(?:\*\*\*\s+)?(?@[0-9a-zA-Z]{16,24}))"), pcre_format( - R"(^(?:\*\*\*\s+)?(?(?:\s|\d{4}[\-\/]\d{2}[\-\/]\d{2}|T|\d{1,2}:\d{2}(?::\d{2}(?:[\.,]\d{1,6})?)?|Z|[+\-]\d{2}:?\d{2}|(?!DBG|DEBUG|ERR|INFO|WARN|NONE)[A-Z]{3,4})+)[:|\s]?(trc|trace|dbg|debug|info|warn(?:ing)?|err(?:or)?)[:|\s]\s*)"), + R"(^(?:\*\*\*\s+)?(?(?:\s|\d{4}[\-\/]\d{2}[\-\/]\d{2}|T|\d{1,2}:\d{2}(?::\d{2}(?:[\.,]\d{1,9})?)?|Z|[+\-]\d{2}:?\d{2}|(?!DBG|DEBUG|ERR|INFO|WARN|NONE)[A-Z]{3,4})+)[:|\s]?(trc|trace|dbg|debug|info|warn(?:ing)?|err(?:or)?)[:|\s]\s*)"), pcre_format( R"(^(?:\*\*\*\s+)?(?[\w:+ \.,+/-]+) \[(trace|debug|info|warn(?:ing)?|error|critical)\]\s+)"), pcre_format( From 9119ff81edd24369ff8b253c3f17f798ec3bf397 Mon Sep 17 00:00:00 2001 From: Alexander Garustovich Date: Mon, 2 Mar 2026 12:48:48 +0300 Subject: [PATCH 2/2] [test] add nanosecond timestamp test for generic_log --- test/Makefile.am | 1 + test/logfile_generic_nanos.0 | 2 ++ test/test_logfile.sh | 7 +++++++ 3 files changed, 10 insertions(+) create mode 100644 test/logfile_generic_nanos.0 diff --git a/test/Makefile.am b/test/Makefile.am index 0f7d213657..bd7756efd7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -364,6 +364,7 @@ dist_noinst_DATA = \ logfile_generic.1 \ logfile_generic.2 \ logfile_generic.3 \ + logfile_generic_nanos.0 \ logfile_generic_with_header.0 \ logfile_glog.0 \ logfile_grafana.0 \ diff --git a/test/logfile_generic_nanos.0 b/test/logfile_generic_nanos.0 new file mode 100644 index 0000000000..0d04386e52 --- /dev/null +++ b/test/logfile_generic_nanos.0 @@ -0,0 +1,2 @@ +2025-01-01 00:00:00.123456789:INFO:nano first +2025-01-01 01:00:00.987654321:WARN:nano second \ No newline at end of file diff --git a/test/test_logfile.sh b/test/test_logfile.sh index f0b02f1880..1568c1e141 100644 --- a/test/test_logfile.sh +++ b/test/test_logfile.sh @@ -548,6 +548,13 @@ Jul 02 10:22:40 2012 -- 672 Oct 08 16:56:38 2014 -- 344 EOF +run_test ./drive_logfile -t -f generic_log ${srcdir}/logfile_generic_nanos.0 + +check_output "generic_log nanosecond timestamp not parsed?" <