From 4cd0d60711c90b1b5b0e3cff7aeffc9fec1301c7 Mon Sep 17 00:00:00 2001 From: Christian Adams Date: Fri, 24 Jan 2020 13:56:01 -0500 Subject: [PATCH] Properly handle logger paths and https/http configuration - log aggregator url paths were not being passed to rsyslog - http log services like loggly will now truly use http and port 80 - add rsyslog.pid to .gitignore --- .gitignore | 1 + awx/main/utils/external_logging.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ac443e2acd..f772abd40c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ awx/ui/templates/ui/installing.html awx/ui_next/node_modules/ awx/ui_next/coverage/ awx/ui_next/build/locales/_build +rsyslog.pid /tower-license /tower-license/** tools/prometheus/data diff --git a/awx/main/utils/external_logging.py b/awx/main/utils/external_logging.py index 26c13b195b..a30003ef5d 100644 --- a/awx/main/utils/external_logging.py +++ b/awx/main/utils/external_logging.py @@ -22,7 +22,7 @@ def reconfigure_rsyslog(): host = parsed.hostname try: - port = parsed.port or settings.LOG_AGGREGATOR_PORT + port = parsed.port except ValueError: port = settings.LOG_AGGREGATOR_PORT @@ -36,6 +36,9 @@ def reconfigure_rsyslog(): # https://github.com/rsyslog/rsyslog-doc/blob/master/source/configuration/modules/omhttp.rst ssl = "on" if parsed.scheme == 'https' else "off" skip_verify = "off" if settings.LOG_AGGREGATOR_VERIFY_CERT else "on" + if not port: + port = 443 if parsed.scheme == 'https' else 80 + params = [ 'type="omhttp"', f'server="{host}"', @@ -45,7 +48,10 @@ def reconfigure_rsyslog(): 'action.resumeRetryCount="-1"', 'template="awx"', 'errorfile="/var/log/tower/external.err"', + 'healthchecktimeout="20000"', ] + if parsed.path: + params.append(f'restpath="{parsed.path[1:]}"') username = getattr(settings, 'LOG_AGGREGATOR_USERNAME', '') password = getattr(settings, 'LOG_AGGREGATOR_PASSWORD', '') if username: