From 1000dc10fbd92c8f965f6313ee77e0ab683fda4b Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 9 Apr 2020 13:57:44 -0400 Subject: [PATCH] an an rsyslogd config check to the logging test endpoint --- awx/conf/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/awx/conf/views.py b/awx/conf/views.py index 580a0d2e52..1e4f33450c 100644 --- a/awx/conf/views.py +++ b/awx/conf/views.py @@ -4,6 +4,7 @@ # Python import collections import logging +import subprocess import sys import socket from socket import SHUT_RDWR @@ -173,6 +174,14 @@ class SettingLoggingTest(GenericAPIView): hostname = getattr(settings, 'LOG_AGGREGATOR_HOST', None) protocol = getattr(settings, 'LOG_AGGREGATOR_PROTOCOL', None) + + try: + subprocess.check_output( + ['rsyslogd', '-N1', '-f', '/var/lib/awx/rsyslog/rsyslog.conf'], + stderr=subprocess.STDOUT + ) + except subprocess.CalledProcessError as exc: + return Response({'error': exc.output}, status=status.HTTP_400_BAD_REQUEST) # Check to ensure port is open at host if protocol in ['udp', 'tcp']: