From e3701dd3dbfe5febda0de2b0343cbc8949ef9353 Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Thu, 18 Aug 2022 19:09:49 -0400 Subject: [PATCH] Respect LOG_AGGREGATOR_LEVEL --- .../templates/configmaps/config.yaml.j2 | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/roles/installer/templates/configmaps/config.yaml.j2 b/roles/installer/templates/configmaps/config.yaml.j2 index aa795d14..8a8de56a 100644 --- a/roles/installer/templates/configmaps/config.yaml.j2 +++ b/roles/installer/templates/configmaps/config.yaml.j2 @@ -81,35 +81,34 @@ data: EMAIL_HOST_USER = '' EMAIL_HOST_PASSWORD = '' EMAIL_USE_TLS = False - - LOGGING['handlers']['console'] = { - '()': 'logging.StreamHandler', - 'level': 'DEBUG', - 'formatter': 'simple', - 'filters': ['guid'], - } - - LOGGING['loggers']['django.request']['handlers'] = ['console'] - LOGGING['loggers']['rest_framework.request']['handlers'] = ['console'] - LOGGING['loggers']['awx']['handlers'] = ['console', 'external_logger'] - LOGGING['loggers']['awx.main.commands.run_callback_receiver']['handlers'] = ['console'] - LOGGING['loggers']['awx.main.tasks']['handlers'] = ['console', 'external_logger'] - LOGGING['loggers']['awx.main.scheduler']['handlers'] = ['console', 'external_logger'] - LOGGING['loggers']['django_auth_ldap']['handlers'] = ['console'] - LOGGING['loggers']['social']['handlers'] = ['console'] - LOGGING['loggers']['system_tracking_migrations']['handlers'] = ['console'] - LOGGING['loggers']['rbac_migrations']['handlers'] = ['console'] - LOGGING['handlers']['callback_receiver'] = {'class': 'logging.NullHandler'} - LOGGING['handlers']['task_system'] = {'class': 'logging.NullHandler'} - LOGGING['handlers']['tower_warnings'] = {'class': 'logging.NullHandler'} - LOGGING['handlers']['rbac_migrations'] = {'class': 'logging.NullHandler'} - LOGGING['handlers']['system_tracking_migrations'] = {'class': 'logging.NullHandler'} - LOGGING['handlers']['management_playbooks'] = {'class': 'logging.NullHandler'} USE_X_FORWARDED_PORT = True BROADCAST_WEBSOCKET_PORT = 8052 BROADCAST_WEBSOCKET_PROTOCOL = 'http' + # LOGGING in defaults.py is oriented towards VM installs where we write to files under + # /var/log/tower. This ensures everything is logged to stdout. + for handler in LOGGING['handlers']: + if handler == 'external_logger': + continue + + if handler == 'console': + LOGGING['handlers'][handler]['filters'].remove('require_debug_true_or_test') + + continue + + filename = LOGGING['handlers'][handler].get('filename') + if filename: + del LOGGING['handlers'][handler]['filename'] + + LOGGING['handlers'][handler]['class'] = 'logging.NullHandler' + + for logger in LOGGING['loggers']: + handlers = LOGGING['loggers'][logger].get('handlers') + if handlers and 'file' in handlers: + handlers.remove('file') + + {% for item in extra_settings | default([]) %} {{ item.setting }} = {{ item.value }} {% endfor %}