summaryrefslogtreecommitdiff
path: root/src/ingestor.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-01-18 01:36:06 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2026-01-18 01:36:06 +0000
commit04acfa679fd846ac829ded5562093b3766c85154 (patch)
treea9625eb96c8c4ed246b1f4d172c06d85df577dfe /src/ingestor.cpp
parent34051da2f27ffa40d0b6d20ae891a497fe73bfe5 (diff)
downloadwebstat-04acfa679fd846ac829ded5562093b3766c85154.tar.bz2
webstat-04acfa679fd846ac829ded5562093b3766c85154.tar.xz
webstat-04acfa679fd846ac829ded5562093b3766c85154.zip
Process new field, content-type, in input streamHEADmain
Diffstat (limited to 'src/ingestor.cpp')
-rw-r--r--src/ingestor.cpp11
1 files changed, 7 insertions, 4 deletions
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<ToEntity<EntityType::VirtualHost>, std::identity, std::identity, std::identity,
ToEntity<EntityType::Path>, ToEntity<EntityType::QueryString>, std::identity, std::identity,
- std::identity, std::identity, ToEntity<EntityType::Referrer>, ToEntity<EntityType::UserAgent>>
+ std::identity, std::identity, ToEntity<EntityType::Referrer>, ToEntity<EntityType::UserAgent>,
+ ToEntity<EntityType::ContentType>>
ENTITY_TYPE_MAP;
static constexpr size_t VALUE_COUNT = std::tuple_size_v<Ingestor::ScanValues>;
static_assert(VALUE_COUNT == std::tuple_size_v<decltype(ENTITY_TYPE_MAP)>);
@@ -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<const std::optional<Entity>> values) const
{
- static constexpr std::array<std::pair<std::string_view, void (Ingestor::*)(const Entity &) const>, 8>
+ static constexpr std::array<std::pair<std::string_view, void (Ingestor::*)(const Entity &) const>, 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);