* `topSlow([top][, limit][, labels])`: show `top` queries slower than `limit` milliseconds, grouped by last `labels` labels
* `topBandwidth(top)`: show top-`top` clients that consume the most bandwidth over length of ringbuffer
* `topClients(n)`: show top-`n` clients sending the most queries over length of ringbuffer
+ * `setRingBuffersSize(n)`: set the capacity of the ringbuffers used for live traffic inspection to `n` (default to 10000)
* `showResponseLatency()`: show a plot of the response time latency distribution
* `showTCPStats()`: show some statistics regarding TCP
* `showVersion()`: show the current version of dnsdist
{ "setMaxUDPOutstanding", true, "n", "set the maximum number of outstanding UDP queries to a given backend server. This can only be set at configuration time and defaults to 10240" },
{ "setQueryCount", true, "bool", "set whether queries should be counted" },
{ "setQueryCountFilter", true, "func", "filter queries that would be counted, where `func` is a function with parameter `dq` which decides whether a query should and how it should be counted" },
+ { "setRingBuffersSize", true, "n", "set the capacity of the ringbuffers used for live traffic inspection to `n`" },
{ "setRules", true, "list of rules", "replace the current rules with the supplied list of pairs of DNS Rules and DNS Actions (see `newRuleAction()`)" },
{ "setServerPolicy", true, "policy", "set server selection policy to that policy" },
{ "setServerPolicyLua", true, "name, function", "set server selection policy to one named 'name' and provided by 'function'" },
setLuaSideEffect();
g_servFailOnNoPolicy = servfail;
});
+
+ g_lua.writeFunction("setRingBuffersSize", [](size_t capacity) {
+ setLuaSideEffect();
+ if (g_configurationDone) {
+ errlog("setRingBuffersSize() cannot be used at runtime!");
+ g_outputBuffer="setRingBuffersSize() cannot be used at runtime!\n";
+ return;
+ }
+ g_rings.setCapacity(capacity);
+ });
}
};
struct Rings {
- Rings()
+ Rings(size_t capacity=10000)
{
- queryRing.set_capacity(10000);
- respRing.set_capacity(10000);
+ queryRing.set_capacity(capacity);
+ respRing.set_capacity(capacity);
pthread_rwlock_init(&queryLock, 0);
}
struct Query
std::unordered_map<int, vector<boost::variant<string,double> > > getTopBandwidth(unsigned int numentries);
size_t numDistinctRequestors();
+ void setCapacity(size_t newCapacity)
+ {
+ {
+ WriteLock wl(&queryLock);
+ queryRing.set_capacity(newCapacity);
+ }
+ {
+ std::lock_guard<std::mutex> lock(respMutex);
+ respRing.set_capacity(newCapacity);
+ }
+ }
};
extern Rings g_rings;