www/nginx: bugfix log not found (#1113)

* www/nginx: bugfix log not found
* www/nginx: release note
This commit is contained in:
Fabian Franz BSc
2019-01-06 19:26:35 +01:00
committed by GitHub
parent 34ae7c8b46
commit abb981ad65
2 changed files with 17 additions and 18 deletions
+1
View File
@@ -11,6 +11,7 @@ Plugin Changelog
1.6
* fix bug due to permission downgrade (basic auth)
* fix bug when multiple hostnames are used, that the logs are not displayed in the log viewer
* add paging support to log viewer, so it does not crash on really big log files
* add basic TLS fingerprint check to make man in the middle attacks visible (may not fully work on LibreSSL crypto flavour as curves seem to return an empty string)
* add dropdown to select authentication backend in HTTP server for advanced authentication
@@ -64,25 +64,23 @@ switch ($mode) {
die('{"error": "The server entry has no server name"}');
}
$lines = [];
foreach (explode(',', $server_names) as $server_name) {
$log_file_name = $log_prefix . basename($server_name) . '.' . $mode . $log_suffix;
// this entry has no log file, ignore it
if (!file_exists($log_file_name)) {
continue;
}
$logparser = null;
if ($mode == 'error') {
$logparser = new ErrorLogParser($log_file_name);
} elseif ($mode == 'access') {
$logparser = new AccessLogParser($log_file_name);
}
// we cannot parse the file - something went wrong
if ($logparser == null) {
continue;
}
$lines = array_merge($lines, $logparser->get_result());
$log_file_name = $log_prefix . basename($server_names) . '.' . $mode . $log_suffix;
// this entry has no log file, ignore it
if (!file_exists($log_file_name)) {
continue;
}
$logparser = null;
if ($mode == 'error') {
$logparser = new ErrorLogParser($log_file_name);
} elseif ($mode == 'access') {
$logparser = new AccessLogParser($log_file_name);
}
// we cannot parse the file - something went wrong
if ($logparser == null) {
continue;
}
$lines = array_merge($lines, $logparser->get_result());
if (empty($lines)) {
$lines['error'] = 'no lines found';
}