summaryrefslogtreecommitdiff
path: root/src/ingestor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ingestor.cpp')
-rw-r--r--src/ingestor.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ingestor.cpp b/src/ingestor.cpp
index db11799..639eed0 100644
--- a/src/ingestor.cpp
+++ b/src/ingestor.cpp
@@ -4,6 +4,7 @@
#include "util.hpp"
#include <connection.h>
#include <dbTypes.h>
+#include <fstream>
#include <modifycommand.h>
#include <ranges>
#include <scn/scan.h>
@@ -148,7 +149,12 @@ namespace WebStat {
void
Ingestor::ingestLogLine(const std::string_view line)
{
- ingestLogLine(dbpool->get().get(), line);
+ try {
+ ingestLogLine(dbpool->get().get(), line);
+ }
+ catch (const std::exception &) {
+ parkLogLine(line);
+ }
}
void
@@ -171,6 +177,13 @@ namespace WebStat {
}
}
+ void
+ Ingestor::parkLogLine(std::string_view line)
+ {
+ std::ofstream {settings.fallbackDir / std::format("parked-{}.log", crc32(line))} << line;
+ linesParked++;
+ }
+
template<typename... T>
Ingestor::NewEntities
Ingestor::newEntities(const std::tuple<T...> & values) const