Skip to content

Commit 57c02e3

Browse files
authored
Remove rsyslog plugin from all non eventd containers (#21338)
#### Why I did it Fixes Issue #21227 - As of current, we have rsyslog_plugin and corresponding regex and configuration files in containers like bgp, swss, dhcp_relay. These binaries and files are built as part of the docker container itself. - This change removes that dependency by storing all rsyslog_plugin regex and conference files in the eventd docker container, and at runtime copying them to the host. - Fixes the issue that some images will not be able to publish certain events like "bgp-state", or "dhcp-relay-discard" due to reuse of docker containers during where eventd was disabled. #### How I did it - Removed all rsyslog plugin configuration and regex files from containers such as bgp, swss, dhcp_relay. All files for configuration and regexes are built inside eventd docker container. When eventd docker is started, it will copy these files to the host and restart rsyslog. - sshd regex and zebra regex are removed because those events are currently not being supported. - Possible race condition with rsyslog-config is avoided due to "After" and since rsyslog-config.service is type oneshot, rsyslog-config.sh is guaranteed to complete before eventd.service is called. #### How to verify it Tested on all elastic pipeline for 6 different HWSKUs Arista-7260CX, Arista720DT, Mellanox2700, Cisco 8102, Nokia M0, Arista 7060CX
1 parent 4c46425 commit 57c02e3

35 files changed

+34
-83
lines changed

dockers/docker-config-engine-bookworm/00-load-omprog.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

dockers/docker-config-engine-bookworm/Dockerfile.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ RUN pip3 install redis==5.0.1
4747
COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
4848
COPY ["files/readiness_probe.sh", "/usr/bin/"]
4949
COPY ["files/container_startup.py", "/usr/share/sonic/scripts/"]
50-
COPY ["00-load-omprog.conf", "/etc/rsyslog.d/"]
5150

5251
## Clean up
5352
RUN apt-get purge -y \

dockers/docker-config-engine-bullseye/00-load-omprog.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

dockers/docker-config-engine-bullseye/Dockerfile.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ RUN pip3 install redis==4.5.4
5050
COPY ["files/swss_vars.j2", "/usr/share/sonic/templates/"]
5151
COPY ["files/readiness_probe.sh", "/usr/bin/"]
5252
COPY ["files/container_startup.py", "/usr/share/sonic/scripts/"]
53-
COPY ["00-load-omprog.conf", "/etc/rsyslog.d/"]
5453

5554
## Clean up
5655
RUN apt-get purge -y \

dockers/docker-dhcp-relay/Dockerfile.j2

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,4 @@ COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
5050
COPY ["critical_processes", "/etc/supervisor"]
5151
COPY ["cli", "/cli/"]
5252

53-
{% if include_system_eventd == "y" and build_reduce_image_size != "y" %}
54-
# Copy regex json and rsyslog_plugin.conf file into rsyslog.d
55-
COPY ["*.json", "/etc/rsyslog.d/"]
56-
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
57-
# Create dhcp_relay_regex.conf
58-
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/dhcp_relay_events.conf
59-
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
60-
RUN rm -f /etc/rsyslog.d/events_info.json
61-
{% endif %}
62-
6353
ENTRYPOINT ["/usr/bin/docker_init.sh"]

dockers/docker-eventd/Dockerfile.j2

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,27 @@ RUN apt-get clean -y && \
2828
apt-get autoremove -y && \
2929
rm -rf /debs
3030

31+
RUN mkdir -p /etc/rsyslog.d/rsyslog_plugin_conf
32+
3133
COPY ["start.sh", "/usr/bin/"]
3234
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
3335
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
3436
COPY ["critical_processes", "/etc/supervisor"]
37+
COPY ["*.json", "/etc/rsyslog.d/rsyslog_plugin_conf/"]
38+
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/rsyslog_plugin_conf/"]
39+
40+
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/host_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/host_events.conf
41+
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/bgp_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/bgp_events.conf
42+
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/dhcp_relay_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/dhcp_relay_events.conf
43+
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/swss_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/swss_events.conf
44+
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2 /etc/rsyslog.d/rsyslog_plugin_conf/syncd_events_info.json > /etc/rsyslog.d/rsyslog_plugin_conf/syncd_events.conf
45+
46+
47+
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/rsyslog_plugin.conf.j2
48+
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/host_events_info.json
49+
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/bgp_events_info.json
50+
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/dhcp_relay_events_info.json
51+
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/swss_events_info.json
52+
RUN rm -f /etc/rsyslog.d/rsyslog_plugin_conf/syncd_events_info.json
3553

3654
ENTRYPOINT ["/usr/local/bin/supervisord"]
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)