Entries without a netmask will be interpreted as a single address.
By default, this list is set to ``127.0.0.0/8`` and ``::1/128``.
+:webserver-loglevel:
+ How much the webserver should log: 'none', 'normal' or 'detailed'.
+ When logging, each log-line contains the UUID of the request, this allows finding errors caused by certain requests.
+ With 'none', nothing is logged except for errors.
+ With 'normal' (the default), one line per request is logged in the style of the common log format::
+ [NOTICE] [webserver] 46326eef-b3ba-4455-8e76-15ec73879aa3 127.0.0.1:57566 "GET /metrics HTTP/1.1" 200 1846
+ with 'detailed', the full requests and responses (including headers) are logged along with the regular log-line from 'normal'.
+
See also
--------
statbag.cc \
threadname.hh threadname.cc \
tsigverifier.cc tsigverifier.hh \
- uuid-utils.hh uuid-utils.cc \
unix_utility.cc \
+ uuid-utils.hh uuid-utils.cc \
webserver.hh webserver.cc \
zoneparser-tng.cc
string doGetStats();
-IXFRDistWebServer::IXFRDistWebServer(const ComboAddress &listenAddress, const NetmaskGroup &acl) :
+IXFRDistWebServer::IXFRDistWebServer(const ComboAddress &listenAddress, const NetmaskGroup &acl, const string &loglevel) :
d_ws(std::unique_ptr<WebServer>(new WebServer(listenAddress.toString(), listenAddress.getPort())))
{
d_ws->setACL(acl);
+ d_ws->setLogLevel(loglevel);
d_ws->registerWebHandler("/metrics", boost::bind(&IXFRDistWebServer::getMetrics, this, _1, _2));
d_ws->bind();
}
class IXFRDistWebServer
{
public:
- explicit IXFRDistWebServer(const ComboAddress &listenAddress, const NetmaskGroup &acl);
+ explicit IXFRDistWebServer(const ComboAddress &listenAddress, const NetmaskGroup &acl, const string &loglevel);
void go();
private:
}
}
+ if (config["webserver-loglevel"]) {
+ try {
+ config["webserver-loglevel"].as<string>();
+ }
+ catch (const runtime_error &e) {
+ g_log<<Logger::Error<<"Unable to read 'webserver-loglevel' value: "<<e.what()<<endl;
+ retval = false;
+ }
+ }
+
return retval;
}
}
}
+ string loglevel = "normal";
+ if (config["webserver-loglevel"]) {
+ loglevel = config["webserver-loglevel"].as<string>();
+ }
+
// Launch the webserver!
- std::thread(&IXFRDistWebServer::go, IXFRDistWebServer(config["webserver-address"].as<ComboAddress>(), wsACL)).detach();
+ try {
+ std::thread(&IXFRDistWebServer::go, IXFRDistWebServer(config["webserver-address"].as<ComboAddress>(), wsACL, loglevel)).detach();
+ } catch (const PDNSException &e) {
+ g_log<<Logger::Error<<"Unable to start webserver: "<<e.reason<<endl;
+ had_error = true;
+ }
}
int newuid = 0;
- 127.0.0.0/8
- ::1/128
+# How much the webserver should log: 'none', 'normal' or 'detailed'
+# With 'none', nothing is logged except for errors
+# With 'normal' (the default), one line per request is logged in the style of the common log format
+# with 'detailed', the full requests and responses (including headers) are logged
+webserver-loglevel: normal
+
# The domains to redistribute, the 'master' and 'domains' keys are mandatory.
# When no port is specified, 53 is used. When specifying ports for IPv6, use the
# "bracket" notation: