Unbound: Add options for logging queries and extended statistics. (#3865)

This commit is contained in:
Flightkick 2020-01-02 08:35:52 +01:00 committed by Franco Fichtner
parent 28be3a171e
commit 7018ffa38d
2 changed files with 26 additions and 0 deletions

View File

@ -225,6 +225,8 @@ EOF;
$infra_cache_numhosts = !empty($config['unbound']['infra_cache_numhosts']) ? $config['unbound']['infra_cache_numhosts'] : "10000";
$unwanted_reply_threshold = !empty($config['unbound']['unwanted_reply_threshold']) && is_numeric($config['unbound']['unwanted_reply_threshold']) ? $config['unbound']['unwanted_reply_threshold'] : "0";
$verbosity = isset($config['unbound']['log_verbosity']) ? $config['unbound']['log_verbosity'] : 1;
$extended_statistics = !empty($config['unbound']['extended_statistics']) ? 'yes' : 'no';
$log_queries = !empty($config['unbound']['log_queries']) ? 'yes' : 'no';
$msgcachesize = !empty($config['unbound']['msgcachesize']) ? $config['unbound']['msgcachesize'] : 4;
$rrsetcachesize = $msgcachesize * 2;
$dnssecstripped = !empty($config['unbound']['dnssecstripped']) ? 'yes' : 'no';
@ -286,6 +288,8 @@ root-hints: /var/unbound/root.hints
use-syslog: yes
port: {$port}
verbosity: {$verbosity}
extended-statistics: {$extended_statistics}
log-queries: {$log_queries}
hide-identity: {$hide_id}
hide-version: {$hide_version}
harden-referral-path: no

View File

@ -59,6 +59,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['log_verbosity'] = "1";
// boolean fields
$pconfig['extended_statistics'] = isset($config['unbound']['extended_statistics']);
$pconfig['log_queries'] = isset($config['unbound']['log_queries']);
$pconfig['hideidentity'] = isset($config['unbound']['hideidentity']);
$pconfig['hideversion'] = isset($config['unbound']['hideversion']);
$pconfig['prefetch'] = isset($config['unbound']['prefetch']);
@ -84,6 +86,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} else {
$pconfig = $_POST;
// boolean fields
$config['unbound']['extended_statistics'] = !empty($pconfig['extended_statistics']);
$config['unbound']['log_queries'] = !empty($pconfig['log_queries']);
$config['unbound']['hideidentity'] = !empty($pconfig['hideidentity']);
$config['unbound']['hideversion'] = !empty($pconfig['hideversion']);
$config['unbound']['prefetch'] = !empty($pconfig['prefetch']);
@ -349,6 +353,24 @@ include_once("head.inc");
</div>
</td>
</tr>
<tr>
<td><a id="help_for_extended_statistics" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('Extended statistics') ?></td>
<td>
<input name="extended_statistics" type="checkbox" id="extended_statistics" value="yes" <?= empty($pconfig['extended_statistics']) ? '' : 'checked="checked"' ?> />
<div class="hidden" data-for="help_for_extended_statistics">
<?= gettext("If enabled, extended statistics are printed.") ?>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_log_queries" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('Log Queries') ?></td>
<td>
<input name="log_queries" type="checkbox" id="log_queries" value="yes" <?= empty($pconfig['log_queries']) ? '' : 'checked="checked"' ?> />
<div class="hidden" data-for="help_for_log_queries">
<?= gettext("If enabled, prints one line per query to the log, with the log timestamp and IP address, name, type and class.") ?>
</div>
</td>
</tr>
<tr>
<td></td>
<td>