Add rsyslog config to container from file for consistency

This commit is contained in:
Christian Adams 2020-04-08 00:50:20 -04:00
parent 470159b4d7
commit 2329c1b797
6 changed files with 14 additions and 13 deletions

View File

@ -65,14 +65,6 @@ def construct_rsyslog_conf_template(settings=settings):
parts.append(
f'action(type="omfwd" target="{host}" port="{port}" protocol="{protocol}" action.resumeRetryCount="-1" template="awx")' # noqa
)
else:
# If logging is disabled, add a valid config and discard all messages
parts = [
'$WorkDirectory /var/lib/awx/rsyslog',
'$IncludeConfig /etc/rsyslog.d/*.conf',
'*.* stop'
f'action(type="omfwd" target="localhost" port="9000" protocol="udp")'
]
tmpl = '\n'.join(parts)
return tmpl

View File

@ -0,0 +1,4 @@
$WorkDirectory /var/lib/awx/rsyslog
$IncludeConfig /etc/rsyslog.d/*.conf
*.* stop
action(type="omfwd" target="localhost" port="9000" protocol="udp")

View File

@ -101,7 +101,7 @@ ADD rsyslog.repo /etc/yum.repos.d/
RUN yum install -y rsyslog-omhttp
# Pre-create things that we need to write to
RUN for dir in /home/awx /var/run/supervisor /var/lib/awx/rsyslog /var/run/rsyslog /var/log/tower /var/log/nginx /var/lib/nginx; \
RUN for dir in /home/awx /var/run/supervisor /var/lib/awx /var/lib/awx/rsyslog /var/run/rsyslog /var/log/tower /var/log/nginx /var/lib/nginx; \
do mkdir -p $dir; chmod -R g+rwx $dir; chgrp -R root $dir; done && \
\
for file in /etc/passwd /var/run/nginx.pid; \
@ -116,7 +116,7 @@ RUN find /var/lib/awx -not -path '/var/lib/awx/venv*' | xargs chgrp root && \
chmod u+s /usr/bin/bwrap # https://github.com/ansible/awx/issues/5224
# Create default awx rsyslog.conf
RUN echo -e '$WorkDirectory /var/lib/awx/rsyslog\n$IncludeConfig /etc/rsyslog.d/*.conf' >> /var/lib/awx/rsyslog/rsyslog.conf
ADD rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf
RUN ln -sf /dev/stdout /var/log/nginx/access.log && \

View File

@ -7,4 +7,5 @@ data:
rsyslog-config: |
$WorkDirectory /var/lib/awx/rsyslog
$IncludeConfig /etc/rsyslog.d/*.conf
*.* stop
action(type="omfwd" target="localhost" port="9000" protocol="udp")

View File

@ -123,7 +123,7 @@ ADD tools/docker-compose/entrypoint.sh /
ADD tools/scripts/awx-python /usr/bin/awx-python
# Pre-create things that we need to write to
RUN for dir in /var/lib/awx/rsyslog /var/run/rsyslog /var/log/tower/ /var/lib/awx/projects /.ansible /var/log/nginx /var/lib/nginx /.local; \
RUN for dir in /var/lib/awx /var/lib/awx/rsyslog /var/run/rsyslog /var/log/tower/ /var/lib/awx/projects /.ansible /var/log/nginx /var/lib/nginx /.local; \
do mkdir -p $dir; chmod -R g+rwx $dir; chgrp -R root $dir; done && \
\
for file in /etc/passwd /etc/supervisord.conf /venv/awx/lib/python3.6/site-packages/awx.egg-link /var/run/nginx.pid; \
@ -133,7 +133,7 @@ RUN for dir in /var/lib/awx/rsyslog /var/run/rsyslog /var/log/tower/ /var/lib/aw
RUN chmod -R 0775 /var/lib/awx /var/lib/awx/rsyslog
ADD tools/docker-compose/rsyslog.repo /etc/yum.repos.d/
RUN yum install -y rsyslog-omhttp
RUN echo -e '$WorkDirectory /var/lib/awx/rsyslog\n$IncludeConfig /etc/rsyslog.d/*.conf' >> /var/lib/awx/rsyslog/rsyslog.conf
ADD tools/docker-compose/rsyslog.conf /var/lib/awx/rsyslog/rsyslog.conf
RUN chmod 0775 /var/lib/awx/rsyslog/rsyslog.conf
ENV HOME /var/lib/awx

View File

@ -0,0 +1,4 @@
$WorkDirectory /var/lib/awx/rsyslog
$IncludeConfig /etc/rsyslog.d/*.conf
*.* stop
action(type="omfwd" target="localhost" port="9000" protocol="udp")