]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
remove api-logfile flag and grep API endpoint
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 4 Oct 2018 16:52:46 +0000 (18:52 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 4 Oct 2018 16:52:46 +0000 (18:52 +0200)
pdns/common_startup.cc
pdns/pdns_recursor.cc
pdns/recursordist/docs/settings.rst
pdns/ws-api.cc
pdns/ws-api.hh
pdns/ws-auth.cc
pdns/ws-recursor.cc

index e4270e290107e727e364429aa8c91565ea3eac46..7dfce29c5b40696f24a1be462649cce64d294042 100644 (file)
@@ -95,7 +95,6 @@ void declareArguments()
   ::arg().set("retrieval-threads", "Number of AXFR-retrieval threads for slave operation")="2";
   ::arg().setSwitch("api", "Enable/disable the REST API (including HTTP listener)")="no";
   ::arg().set("api-key", "Static pre-shared authentication key for access to the REST API")="";
-  ::arg().set("api-logfile", "Location of the server logfile (used by the REST API)")="/var/log/pdns.log";
   ::arg().setSwitch("dname-processing", "If we should support DNAME records")="no";
 
   ::arg().setCmd("help","Provide a helpful message");
index c3f10623caae9f681b0f61262de55014fb7afe09..3c7ec0ee31e843d1c59d7453022af3fc568fac76 100644 (file)
@@ -3975,7 +3975,6 @@ int main(int argc, char **argv)
     ::arg().set("config-name","Name of this virtual configuration - will rename the binary image")="";
     ::arg().set("api-config-dir", "Directory where REST API stores config and zones") = "";
     ::arg().set("api-key", "Static pre-shared authentication key for access to the REST API") = "";
-    ::arg().set("api-logfile", "Location of the server logfile (used by the REST API)") = "/var/log/pdns.log";
     ::arg().setSwitch("webserver", "Start a webserver (for REST API)") = "no";
     ::arg().set("webserver-address", "IP Address of webserver to listen on") = "127.0.0.1";
     ::arg().set("webserver-port", "Port of webserver to listen on") = "8082";
index 276365c257bc99fad00d874ece7219f986ed7905..7f82baf397ba00cfca4f6cf4dd4ec5feed029999 100644 (file)
@@ -94,6 +94,8 @@ Disallow data modification through the REST API when set.
 ``api-logfile``
 ---------------
 .. versionadded:: 4.0.0
+.. versionchanged:: 4.2.0
+  This setting has been removed.
 
 -  Path
 -  Default: unset
index 2df73657c4de932873245e605b37b86446e236dc..54776cd1e3b89bf0691ed2bfa9954d79c2272ec8 100644 (file)
@@ -155,53 +155,6 @@ void apiServerConfig(HttpRequest* req, HttpResponse* resp) {
   resp->setBody(doc);
 }
 
-static Json logGrep(const string& q, const string& fname, const string& prefix)
-{
-  FILE* ptr = fopen(fname.c_str(), "r");
-  if(!ptr) {
-    throw ApiException("Opening \"" + fname + "\" failed: " + stringerror());
-  }
-  std::shared_ptr<FILE> fp(ptr, fclose);
-
-  string line;
-  string needle = q;
-  trim_right(needle);
-
-  boost::replace_all(needle, "%20", " ");
-  boost::replace_all(needle, "%22", "\"");
-
-  boost::tokenizer<boost::escaped_list_separator<char> > t(needle, boost::escaped_list_separator<char>("\\", " ", "\""));
-  vector<string> matches(t.begin(), t.end());
-  matches.push_back(prefix);
-
-  boost::circular_buffer<string> lines(200);
-  while(stringfgets(fp.get(), line)) {
-    vector<string>::const_iterator iter;
-    for(iter = matches.begin(); iter != matches.end(); ++iter) {
-      if(!strcasestr(line.c_str(), iter->c_str()))
-        break;
-    }
-    if(iter == matches.end()) {
-      trim_right(line);
-      lines.push_front(line);
-    }
-  }
-
-  Json::array items;
-  for(const string& iline : lines) {
-    items.push_back(iline);
-  }
-  return items;
-}
-
-void apiServerSearchLog(HttpRequest* req, HttpResponse* resp) {
-  if(req->method != "GET")
-    throw HttpMethodNotAllowedException();
-
-  string prefix = " " + s_programname + "[";
-  resp->setBody(logGrep(req->getvars["q"], ::arg()["api-logfile"], prefix));
-}
-
 void apiServerStatistics(HttpRequest* req, HttpResponse* resp) {
   if(req->method != "GET")
     throw HttpMethodNotAllowedException();
index 1bbd6b55c297ecee1f8825af5ad50b3e87e391ed..0de6eda580b93760b2aaece1179bac32cc20d508 100644 (file)
@@ -30,7 +30,6 @@ void apiDiscovery(HttpRequest* req, HttpResponse* resp);
 void apiServer(HttpRequest* req, HttpResponse* resp);
 void apiServerDetail(HttpRequest* req, HttpResponse* resp);
 void apiServerConfig(HttpRequest* req, HttpResponse* resp);
-void apiServerSearchLog(HttpRequest* req, HttpResponse* resp);
 void apiServerStatistics(HttpRequest* req, HttpResponse* resp);
 
 // helpers
index e025d2b4349f074f6d481839601dd2b30e228378..1df76b16689b0d6872a466aca8ac6361c2623a1f 100644 (file)
@@ -1955,7 +1955,6 @@ void AuthWebServer::webThread()
     if(::arg().mustDo("api")) {
       d_ws->registerApiHandler("/api/v1/servers/localhost/cache/flush", &apiServerCacheFlush);
       d_ws->registerApiHandler("/api/v1/servers/localhost/config", &apiServerConfig);
-      d_ws->registerApiHandler("/api/v1/servers/localhost/search-log", &apiServerSearchLog);
       d_ws->registerApiHandler("/api/v1/servers/localhost/search-data", &apiServerSearchData);
       d_ws->registerApiHandler("/api/v1/servers/localhost/statistics", &apiServerStatistics);
       d_ws->registerApiHandler("/api/v1/servers/localhost/zones/<id>/axfr-retrieve", &apiServerZoneAxfrRetrieve);
index 96b2549f705f8bf6707a5aa0e1aa59cada91ed8e..3c3697fe5ff12c59a3b4f24b7d094844f191ebfb 100644 (file)
@@ -458,7 +458,6 @@ RecursorWebServer::RecursorWebServer(FDMultiplexer* fdm)
   d_ws->registerApiHandler("/api/v1/servers/localhost/config/allow-from", &apiServerConfigAllowFrom);
   d_ws->registerApiHandler("/api/v1/servers/localhost/config", &apiServerConfig);
   d_ws->registerApiHandler("/api/v1/servers/localhost/rpzstatistics", &apiServerRPZStats);
-  d_ws->registerApiHandler("/api/v1/servers/localhost/search-log", &apiServerSearchLog);
   d_ws->registerApiHandler("/api/v1/servers/localhost/search-data", &apiServerSearchData);
   d_ws->registerApiHandler("/api/v1/servers/localhost/statistics", &apiServerStatistics);
   d_ws->registerApiHandler("/api/v1/servers/localhost/zones/<id>", &apiServerZoneDetail);