From 04acfa679fd846ac829ded5562093b3766c85154 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 18 Jan 2026 01:36:06 +0000 Subject: Process new field, content-type, in input stream --- src/ingestor.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/ingestor.cpp') diff --git a/src/ingestor.cpp b/src/ingestor.cpp index 81642be..da39c59 100644 --- a/src/ingestor.cpp +++ b/src/ingestor.cpp @@ -54,7 +54,8 @@ namespace WebStat { { static constexpr std::tuple, std::identity, std::identity, std::identity, ToEntity, ToEntity, std::identity, std::identity, - std::identity, std::identity, ToEntity, ToEntity> + std::identity, std::identity, ToEntity, ToEntity, + ToEntity> ENTITY_TYPE_MAP; static constexpr size_t VALUE_COUNT = std::tuple_size_v; static_assert(VALUE_COUNT == std::tuple_size_v); @@ -99,8 +100,9 @@ namespace WebStat { unsigned int, // size : %B : 1234 unsigned int, // duration : %D : 1234 CLFString, // referrer : "%{Referer}i" : "https://google.com/whatever" or "-" - CLFString // user_agent : "%{User-agent}i" : "Chromium v123.4" or "-" - >(input, R"({} {} {} {:[A-Z]} {} {} {} {} {} {} {} {})"); + CLFString, // user_agent : "%{User-agent}i" : "Chromium v123.4" or "-" + CLFString // content_type : "%{Content-type}o" : "test/plain" or "-" + >(input, R"({} {} {} {:[A-Z]} {} {} {} {} {} {} {} {} {})"); } void @@ -321,7 +323,7 @@ namespace WebStat { Ingestor::NewEntityIds Ingestor::storeEntities(DB::Connection * dbconn, const std::span> values) const { - static constexpr std::array, 8> + static constexpr std::array, 9> ENTITY_TYPE_VALUES {{ {"host", nullptr}, {"virtual_host", nullptr}, @@ -331,6 +333,7 @@ namespace WebStat { {"user_agent", &Ingestor::onNewUserAgent}, {"unparsable_line", nullptr}, {"uninsertable_line", nullptr}, + {"content_type", nullptr}, }}; auto insert = dbconn->modify(SQL::ENTITY_INSERT, SQL::ENTITY_INSERT_OPTS); -- cgit v1.2.3