diff --git a/bundles/nginx/files/site_template b/bundles/nginx/files/site_template index bccff8c..a3271e3 100644 --- a/bundles/nginx/files/site_template +++ b/bundles/nginx/files/site_template @@ -57,7 +57,9 @@ server { % if create_access_log: access_log /var/log/nginx/access-${vhost}.log gdpr; % endif +% if create_timing_log: access_log /var/log/nginx-timing/${vhost}.log anon_timing; +% endif # error_log is disabled globally % if max_body_size: diff --git a/bundles/nginx/items.py b/bundles/nginx/items.py index eb59250..4663f92 100644 --- a/bundles/nginx/items.py +++ b/bundles/nginx/items.py @@ -126,6 +126,7 @@ for vhost, config in node.metadata.get('nginx/vhosts', {}).items(): 'content_type': 'mako', 'context': { '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', ''), 'security_txt': security_txt_enabled, 'vhost': vhost, diff --git a/bundles/nginx/metadata.py b/bundles/nginx/metadata.py index ba2d18a..4d926f7 100644 --- a/bundles/nginx/metadata.py +++ b/bundles/nginx/metadata.py @@ -189,9 +189,12 @@ def firewall(metadata): def telegraf_anon_timing(metadata): result = {} - for vhost in metadata.get('nginx/vhosts', {}): - result[f'nginx-{vhost}'] = { - 'files': [f'/var/log/nginx-timing/{vhost}.log'], + for vname, vconfig in metadata.get('nginx/vhosts', {}).items(): + if not vconfig.get('timing_log', True): + continue + + result[f'nginx-{vname}'] = { + 'files': [f'/var/log/nginx-timing/{vname}.log'], 'from_beginning': False, '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}', diff --git a/bundles/weechat/metadata.py b/bundles/weechat/metadata.py index 939bc74..506b5d1 100644 --- a/bundles/weechat/metadata.py +++ b/bundles/weechat/metadata.py @@ -85,6 +85,10 @@ def relay_vhost(metadata): 'vhosts': { 'weechat': { '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': { '/weechat': { 'proxy_read_timeout': '12h',