diff options
author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2025-09-02 16:13:22 +0100 |
---|---|---|
committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2025-09-02 16:13:22 +0100 |
commit | ca9be55a98c094e8026a4003a099573dd4137050 (patch) | |
tree | 1d58e13a84fc6bba25242877859027bdfe8f461e /src/webstat_logger_main.cpp | |
parent | 07a98c0ba7d2fdd79cab1884f81bb041741fc18c (diff) | |
download | webstat-ca9be55a98c094e8026a4003a099573dd4137050.tar.bz2 webstat-ca9be55a98c094e8026a4003a099573dd4137050.tar.xz webstat-ca9be55a98c094e8026a4003a099573dd4137050.zip |
Store utsname details in the host's detail field
Diffstat (limited to 'src/webstat_logger_main.cpp')
-rw-r--r-- | src/webstat_logger_main.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
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<DB::ConnectionPool>(dbMax, dbKeep, std::move(dbType), std::move(dbConnStr)); - WebStat::Ingestor {getHostname(false), pool}.ingestLog(stdin); + WebStat::Ingestor {getHostDetail(), pool}.ingestLog(stdin); return EXIT_SUCCESS; } |