From cb47664b464331b88dad62796729fe08f07f30e4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 5 Jul 2026 17:12:53 +0100 Subject: Update parsed type of duration field uint32_t doesn't cut it, changed to uint64_t. --- src/ingestor.cpp | 4 ++-- src/ingestor.hpp | 2 +- test/test-ingest.cpp | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ingestor.cpp b/src/ingestor.cpp index c06fd1c..41dd24f 100644 --- a/src/ingestor.cpp +++ b/src/ingestor.cpp @@ -193,8 +193,8 @@ namespace WebStat { QueryString, // query_string : "%q" : "?query=string" or "" std::string_view, // protocol : %r : HTTPS/2.0 uint16_t, // status : %>s : 200 - uint64_t, // size : %B : 1234 - uint32_t, // duration : %D : 1234 + uint64_t, // size (bytes) : %B : 1234 + uint64_t, // duration (µs) : %D : 1234 CLFString, // referrer : "%{Referer}i" : "https://google.com/whatever" or "-" CLFString, // user_agent : "%{User-agent}i" : "Chromium v123.4" or "-" CLFString // content_type : "%{Content-type}o" : "test/plain" or "-" diff --git a/src/ingestor.hpp b/src/ingestor.hpp index 1a47a1b..e250072 100644 --- a/src/ingestor.hpp +++ b/src/ingestor.hpp @@ -63,7 +63,7 @@ namespace WebStat { using ScanResult = decltype(scn::scan( + QueryString, std::string_view, uint16_t, uint64_t, uint64_t, CLFString, CLFString, CLFString>( std::declval(), "")); using ScanValues = std::remove_cvref_t()->values())>; diff --git a/test/test-ingest.cpp b/test/test-ingest.cpp index 9c0001b..021f925 100644 --- a/test/test-ingest.cpp +++ b/test/test-ingest.cpp @@ -303,6 +303,15 @@ BOOST_AUTO_TEST_CASE(ExtractFieldsEdgeCasesUnparsable3482917779) R"LOG(lang=../../../../../../../../usr/local/lib/php/pearcmd&+config-create+/&/+/tmp/index1.php)LOG"); } +BOOST_AUTO_TEST_CASE(ExtractFieldsEdgeCasesUnparsable3354288) // Long duration +{ + const auto result = WebStat::Ingestor::scanLogLine( + R"LOG(git.randomdan.homeip.net 216.73.216.212 1770062062011035 GET "/repo/netfs/patch/libfusepp" "?id=46f6aa3507120f4b69a54abc02d8829eac005b6f" HTTP/2.0 200 1 7361204168 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)" "text/plain")LOG"); + BOOST_REQUIRE(result); + const auto duration = std::get<9>(result->values()); + BOOST_CHECK_EQUAL(7361204168, duration); +} + class TestIngestor : public WebStat::Ingestor { public: TestIngestor() : -- cgit v1.3