bundles/nginx: add option to disable anon_timing log
This commit is contained in:
parent
c6bb00c124
commit
757e9e6bb8
4 changed files with 13 additions and 3 deletions
|
@ -57,7 +57,9 @@ server {
|
||||||
% if create_access_log:
|
% if create_access_log:
|
||||||
access_log /var/log/nginx/access-${vhost}.log gdpr;
|
access_log /var/log/nginx/access-${vhost}.log gdpr;
|
||||||
% endif
|
% endif
|
||||||
|
% if create_timing_log:
|
||||||
access_log /var/log/nginx-timing/${vhost}.log anon_timing;
|
access_log /var/log/nginx-timing/${vhost}.log anon_timing;
|
||||||
|
% endif
|
||||||
# error_log is disabled globally
|
# error_log is disabled globally
|
||||||
|
|
||||||
% if max_body_size:
|
% if max_body_size:
|
||||||
|
|
|
@ -126,6 +126,7 @@ for vhost, config in node.metadata.get('nginx/vhosts', {}).items():
|
||||||
'content_type': 'mako',
|
'content_type': 'mako',
|
||||||
'context': {
|
'context': {
|
||||||
'create_access_log': config.get('access_log', node.metadata.get('nginx/access_log', False)),
|
'create_access_log': config.get('access_log', node.metadata.get('nginx/access_log', False)),
|
||||||
|
'create_timing_log': config.get('timing_log', True),
|
||||||
'php_version': node.metadata.get('php/version', ''),
|
'php_version': node.metadata.get('php/version', ''),
|
||||||
'security_txt': security_txt_enabled,
|
'security_txt': security_txt_enabled,
|
||||||
'vhost': vhost,
|
'vhost': vhost,
|
||||||
|
|
|
@ -189,9 +189,12 @@ def firewall(metadata):
|
||||||
def telegraf_anon_timing(metadata):
|
def telegraf_anon_timing(metadata):
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
for vhost in metadata.get('nginx/vhosts', {}):
|
for vname, vconfig in metadata.get('nginx/vhosts', {}).items():
|
||||||
result[f'nginx-{vhost}'] = {
|
if not vconfig.get('timing_log', True):
|
||||||
'files': [f'/var/log/nginx-timing/{vhost}.log'],
|
continue
|
||||||
|
|
||||||
|
result[f'nginx-{vname}'] = {
|
||||||
|
'files': [f'/var/log/nginx-timing/{vname}.log'],
|
||||||
'from_beginning': False,
|
'from_beginning': False,
|
||||||
'grok_patterns': ['%{LOGPATTERN}'],
|
'grok_patterns': ['%{LOGPATTERN}'],
|
||||||
'grok_custom_patterns': 'LOGPATTERN \[%{HTTPDATE:ts:ts-httpd}\] %{NUMBER:request_time:float} (?:%{NUMBER:upstream_response_time:float}|-) "%{WORD:verb:tag} %{NOTSPACE:request} HTTP/%{NUMBER:http_version:float}" %{NUMBER:resp_code:tag}',
|
'grok_custom_patterns': 'LOGPATTERN \[%{HTTPDATE:ts:ts-httpd}\] %{NUMBER:request_time:float} (?:%{NUMBER:upstream_response_time:float}|-) "%{WORD:verb:tag} %{NOTSPACE:request} HTTP/%{NUMBER:http_version:float}" %{NUMBER:resp_code:tag}',
|
||||||
|
|
|
@ -85,6 +85,10 @@ def relay_vhost(metadata):
|
||||||
'vhosts': {
|
'vhosts': {
|
||||||
'weechat': {
|
'weechat': {
|
||||||
'domain': relay_domain,
|
'domain': relay_domain,
|
||||||
|
# This only does websockets connections, which stay
|
||||||
|
# open for a very long time. This only generates
|
||||||
|
# useless metrics.
|
||||||
|
'timing_log': False,
|
||||||
'locations': {
|
'locations': {
|
||||||
'/weechat': {
|
'/weechat': {
|
||||||
'proxy_read_timeout': '12h',
|
'proxy_read_timeout': '12h',
|
||||||
|
|
Loading…
Reference in a new issue