From ca9be55a98c094e8026a4003a099573dd4137050 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 2 Sep 2025 16:13:22 +0100 Subject: Store utsname details in the host's detail field --- src/webstat_logger_main.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/webstat_logger_main.cpp') diff --git a/src/webstat_logger_main.cpp b/src/webstat_logger_main.cpp index 7a47582..7817dc0 100644 --- a/src/webstat_logger_main.cpp +++ b/src/webstat_logger_main.cpp @@ -7,17 +7,14 @@ namespace { [[nodiscard]] - std::string - getHostname(bool fqdn) + utsname + getHostDetail() { utsname uts {}; if (uname(&uts)) { throw std::runtime_error(std::format("Failed to get hostname (uts: {}:{})", errno, strerror(errno))); } - if (fqdn) { - return std::format("{}.{}", uts.nodename, uts.domainname); - } - return uts.nodename; + return uts; } } @@ -60,6 +57,6 @@ main(int argc, char ** argv) po::notify(optVars); auto pool = std::make_shared(dbMax, dbKeep, std::move(dbType), std::move(dbConnStr)); - WebStat::Ingestor {getHostname(false), pool}.ingestLog(stdin); + WebStat::Ingestor {getHostDetail(), pool}.ingestLog(stdin); return EXIT_SUCCESS; } -- cgit v1.2.3