]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/Graylog: assert(!m_hostname.empty()) in Graylog
authorKefu Chai <kchai@redhat.com>
Mon, 5 Jul 2021 02:09:05 +0000 (10:09 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 5 Jul 2021 04:17:49 +0000 (12:17 +0800)
to verify that we always have a non-empty host field in log entry sent
to graylog per the spec of GrayLog. see https://docs.graylog.org/en/4.0/pages/gelf.html#gelf-payload-specification

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/Graylog.cc

index accde0900a50e042f418f80e5499a7d923a61f52..3e9da5fe85a256894fbb9b5f74f9b178520a6ffc 100644 (file)
@@ -58,6 +58,7 @@ void Graylog::set_destination(const std::string& host, int port)
 
 void Graylog::set_hostname(const std::string& host)
 {
+  assert(!host.empty());
   m_hostname = host;
 }