Logging tab

added support for domain specific acces_log / error_log (fixes #6)
pull/23/head
Szekeres Bálint 6 years ago
parent 1ecf62eb67
commit e721697ec5

@ -72,8 +72,12 @@
worker_processes: 'auto',
user: 'www-data',
pid: '/run/nginx.pid',
access_log: '/var/log/nginx/access.log',
error_log: '/var/log/nginx/error.log',
error_log: '/var/log/nginx/error.log warn',
access_log_domain: false,
error_log_domain: false,
client_max_body_size: 16,
gzip: true,
server_tokens: false,
@ -161,6 +165,14 @@
return '/etc/nginx/ssl/' + $scope.domain() + '.key';
};
$scope.accessLogDomainPath = function() {
return $scope.data.access_log.replace(/([^/]+)\.log$/, $scope.domain() + '.$1.log');
};
$scope.errorLogDomainPath = function() {
return $scope.data.error_log.replace(/([^/]+)\.log (.+)$/, $scope.domain() + '.$1.log $2');
};
$scope.refreshHighlighting = function() {
var sourceCodes = document.querySelectorAll('main .file .code.source');
@ -431,6 +443,18 @@
return !!$scope.data.access_log;
};
$scope.isErrorLog = function() {
return !!$scope.data.error_log;
};
$scope.isAccessLogDomain = function() {
return $scope.data.access_log_domain;
};
$scope.isErrorLogDomain = function() {
return $scope.data.error_log_domain;
};
$scope.isGzip = function() {
return $scope.data.gzip;
};

@ -57,6 +57,9 @@
<li class="nav-item">
<a class="nav-link" ng-click="setTab('proxy')" ng-class="{ 'active': tab === 'proxy', 'changed': getChangesForTab('proxy') }">Reverse proxy<small ng-cloak>({{ getChangesForTab('proxy') }})</small></a>
</li>
<li class="nav-item">
<a class="nav-link" ng-click="setTab('logging')" ng-class="{ 'active': tab === 'logging', 'changed': getChangesForTab('logging') }">Logging<small ng-cloak>({{ getChangesForTab('logging') }})</small></a>
</li>
<li class="nav-item">
<a class="nav-link" ng-click="setTab('nginx')" ng-class="{ 'active': tab === 'nginx', 'changed': getChangesForTab('nginx') }">nginx<small ng-cloak>({{ getChangesForTab('nginx') }})</small></a>
</li>
@ -520,6 +523,63 @@
</div>
</div>
</div>
<div class="tab-pane tab-logging" ng-class="{ 'active': tab === 'logging' }">
<div class="form-group row">
<label class="col-sm-3 col-form-label col-form-label-sm">
<code tooltips tooltip-template="Sets the path, format, and configuration for a buffered log write.">access_log</code>
</label>
<div class="col-sm-9">
<input type="text"
class="form-control form-control-sm"
ng-model="data.access_log"
ng-class="{ 'input-changed': data.access_log !== defaultData.access_log }">
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label col-form-label-sm">
<code tooltips tooltip-template="Configures logging path (with warn level).">error_log</code>
</label>
<div class="col-sm-9">
<input type="text"
class="form-control form-control-sm"
ng-model="data.error_log"
ng-class="{ 'input-changed': data.error_log !== defaultData.error_log }">
</div>
</div>
<div class="form-group row" ng-if="isAccessLog()">
<label class="col-sm-3 col-form-label col-form-label-sm">
<span tooltips tooltip-template="Domain specific access_log."><code>access_log</code> by domain</span>
</label>
<div class="col-sm-9">
<div class="form-check" ng-class="{ 'input-changed': data.access_log_domain !== defaultData.access_log_domain }">
<input class="form-check-input" type="checkbox" id="access_log_domain" ng-model="data.access_log_domain">
<label class="form-check-label" for="access_log_domain">enabled</label>
</div>
</div>
</div>
<div class="form-group row" ng-if="isErrorLog()">
<label class="col-sm-3 col-form-label col-form-label-sm">
<span tooltips tooltip-template="Domain specific error_log."><code>error_log</code> by domain</span>
</label>
<div class="col-sm-9">
<div class="form-check" ng-class="{ 'input-changed': data.error_log_domain !== defaultData.error_log_domain }">
<input class="form-check-input" type="checkbox" id="error_log_domain" ng-model="data.error_log_domain">
<label class="form-check-label" for="error_log_domain">enabled</label>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label col-form-label-sm">
<code tooltips tooltip-template="Logging of errors about not found files into error_log.">log_not_found</code>
</label>
<div class="col-sm-9">
<div class="form-check" ng-class="{ 'input-changed': data.log_not_found !== defaultData.log_not_found }">
<input class="form-check-input" type="checkbox" id="log_not_found" ng-model="data.log_not_found">
<label class="form-check-label" for="log_not_found">enabled</label>
</div>
</div>
</div>
</div>
<div class="tab-pane tab-nginx" ng-class="{ 'active': tab === 'nginx' }">
<div class="form-group row">
<label class="col-sm-3 col-form-label col-form-label-sm">
@ -569,28 +629,6 @@
ng-class="{ 'input-changed': data.pid !== defaultData.pid }">
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label col-form-label-sm">
<code tooltips tooltip-template="Sets the path, format, and configuration for a buffered log write.">access_log</code>
</label>
<div class="col-sm-9">
<input type="text"
class="form-control form-control-sm"
ng-model="data.access_log"
ng-class="{ 'input-changed': data.access_log !== defaultData.access_log }">
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label col-form-label-sm">
<code tooltips tooltip-template="Configures logging path (with warn level).">error_log</code>
</label>
<div class="col-sm-9">
<input type="text"
class="form-control form-control-sm"
ng-model="data.error_log"
ng-class="{ 'input-changed': data.error_log !== defaultData.error_log }">
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label col-form-label-sm">
<code tooltips tooltip-template="Sets the maximum allowed size of the client request body.">client_max_body_size</code>
@ -609,17 +647,6 @@
</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label col-form-label-sm">
<code tooltips tooltip-template="Logging of errors about not found files into error_log.">log_not_found</code>
</label>
<div class="col-sm-9">
<div class="form-check" ng-class="{ 'input-changed': data.log_not_found !== defaultData.log_not_found }">
<input class="form-check-input" type="checkbox" id="log_not_found" ng-model="data.log_not_found">
<label class="form-check-label" for="log_not_found">enabled</label>
</div>
</div>
</div>
</div>
<div class="tab-pane tab-tools" ng-class="{ 'active': tab === 'tools' }">
<div class="form-group row">

@ -28,7 +28,7 @@ http {
# logging
access_log {{ isAccessLog() ? data.access_log : 'off' }};
error_log {{ data.error_log }} warn;<!--
error_log {{ isErrorLog() ? data.error_log : '/dev/null' }};<!--
✔ limitReq --><span ng-if="data.limit_req">

@ -21,11 +21,6 @@ server {<!--
✘ PHP --><span ng-if="!isPHP()">
root /var/www/{{ domain() }}{{ data.document_root }};</span><!--
✔ index.php --><span ng-if="isIndexPHP()">
# index.php
index index.php;</span><!--
✔ HTTPS --><span ng-if="isHTTPS()">
# SSL
@ -35,6 +30,19 @@ server {<!--
✔ Let's Encrypt --><span ng-if="isCertLetsEncrypt()">
ssl_trusted_certificate /etc/letsencrypt/live/{{ domain() }}/fullchain.pem;</span></span><!--
✔ access log domain || error log domain --><span ng-if="isAccessLogDomain() || isErrorLogDomain()">
# logging<!--
✔ access log domain --><span ng-if="isAccessLogDomain()">
access_log {{ accessLogDomainPath() }};</span><!--
✔ error log domain --><span ng-if="isErrorLogDomain()">
error_log {{ errorLogDomainPath() }};</span></span><!--
✔ index.php --><span ng-if="isIndexPHP()">
# index.php
index index.php;</span><!--
✔ Fallback HTML || ✔ Fallback PHP --><span ng-if="(isFallbackHTML() || isFallbackPHP()) && (!isProxy() || data.proxy_path !== '/')">
# {{ isFallbackHTML() ? 'index.html' : ( isFallbackPHP() ? 'index.php' : '' ) }} fallback

Loading…
Cancel
Save