mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-10 10:01:48 -05:00
Configure rsyslog to listen over a unix domain socket instead of a port
- Add a placeholder rsyslog.conf so it doesn't fail on start - Create access restricted directory for unix socket to be created in - Create RSyslogHandler to exit early when logging socket doesn't exist - Write updated logging settings when dispatcher comes up and restart rsyslog so they take effect - Move rsyslogd to the web container and create rpc supervisor.sock - Add env var for supervisor.conf path
This commit is contained in:
committed by
Christian Adams
parent
f8afae308a
commit
c0af3c537b
@@ -7,6 +7,7 @@ from awx.main.utils.reload import supervisor_service_command
|
||||
|
||||
def reconfigure_rsyslog():
|
||||
tmpl = ''
|
||||
parts = ['$IncludeConfig /etc/rsyslog.conf']
|
||||
if settings.LOG_AGGREGATOR_ENABLED:
|
||||
host = getattr(settings, 'LOG_AGGREGATOR_HOST', '')
|
||||
port = getattr(settings, 'LOG_AGGREGATOR_PORT', '')
|
||||
@@ -26,11 +27,8 @@ def reconfigure_rsyslog():
|
||||
except ValueError:
|
||||
port = settings.LOG_AGGREGATOR_PORT
|
||||
|
||||
parts = []
|
||||
parts.extend([
|
||||
'$IncludeConfig /etc/rsyslog.conf',
|
||||
'$ModLoad imudp',
|
||||
'$UDPServerRun 51414',
|
||||
'input(type="imuxsock" Socket="/var/run/tower/sockets/rsyslog.sock" unlink="on")',
|
||||
'template(name="awx" type="string" string="%msg%")',
|
||||
])
|
||||
if protocol.startswith('http'):
|
||||
@@ -65,8 +63,8 @@ def reconfigure_rsyslog():
|
||||
parts.append(
|
||||
f'action(type="omfwd" target="{host}" port="{port}" protocol="{protocol}" action.resumeRetryCount="-1" template="awx")' # noqa
|
||||
)
|
||||
tmpl = '\n'.join(parts)
|
||||
|
||||
with open('/var/lib/awx/rsyslog.conf', 'w') as f:
|
||||
tmpl = '\n'.join(parts)
|
||||
with open('/var/lib/awx/rsyslog/rsyslog.conf', 'w') as f:
|
||||
f.write(tmpl + '\n')
|
||||
supervisor_service_command(command='restart', service='awx-rsyslogd')
|
||||
|
||||
Reference in New Issue
Block a user