Skip to content

Commit

Permalink
Fix rsyslog plugin slim image logic (#19034) (#19363)
Browse files Browse the repository at this point in the history
* Fix rsyslog plugin slim image logic

* Remove asic check for broadcom when checking for eventd enabled and slim image

Co-authored-by: Zain Budhwani <[email protected]>
  • Loading branch information
mssonicbld and zbud-msft authored Jun 24, 2024
1 parent 6b3cde4 commit a1215f4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
4 changes: 1 addition & 3 deletions dockers/docker-dhcp-relay/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]
COPY ["cli", "/cli/"]

{% if include_system_eventd == "y" %}
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
{% if include_system_eventd == "y" and build_reduce_image_size != "y" %}
# Copy regex json and rsyslog_plugin.conf file into rsyslog.d
COPY ["*.json", "/etc/rsyslog.d/"]
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
Expand All @@ -60,6 +59,5 @@ RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
RUN rm -f /etc/rsyslog.d/events_info.json
{% endif %}
{% endif %}

ENTRYPOINT ["/usr/bin/docker_init.sh"]
4 changes: 1 addition & 3 deletions dockers/docker-fpm-frr/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ RUN chmod a+x /usr/bin/TSA && \
chmod a+x /usr/bin/TSC && \
chmod a+x /usr/bin/zsocket.sh

{% if include_system_eventd == "y" %}
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
{% if include_system_eventd == "y" and build_reduce_image_size != "y" %}
COPY ["*.json", "/etc/rsyslog.d/"]
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/bgp_events.conf
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
RUN rm -f /etc/rsyslog.d/events_info.json
{% endif %}
{% endif %}

ENTRYPOINT ["/usr/bin/docker_init.sh"]
4 changes: 1 addition & 3 deletions dockers/docker-orchagent/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ RUN sonic-cfggen -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" -t /usr/share/sonic/
RUN rm -f /usr/share/sonic/templates/docker-init.j2
RUN chmod 755 /usr/bin/docker-init.sh

{% if include_system_eventd == "y" %}
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
{% if include_system_eventd == "y" and build_reduce_image_size != "y" %}
# Copy all regex json files and rsyslog_plugin.conf to rsyslog.d
COPY ["*.json", "/etc/rsyslog.d/"]
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
Expand All @@ -89,6 +88,5 @@ RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
RUN rm -f /etc/rsyslog.d/events_info.json
{% endif %}
{% endif %}

ENTRYPOINT ["/usr/bin/docker-init.sh"]
2 changes: 1 addition & 1 deletion files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
{%- if include_macsec == "y" %}{% do features.append(("macsec", "{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'SpineRouter' and DEVICE_RUNTIME_METADATA['MACSEC_SUPPORTED'] %}enabled{% else %}disabled{% endif %}", false, "enabled")) %}{% endif %}
{%- if include_system_gnmi == "y" %}{% do features.append(("gnmi", "enabled", true, "enabled")) %}{% endif %}
{%- if include_system_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %}
{%- if include_system_eventd == "y" and BUILD_REDUCE_IMAGE_SIZE == "y" and sonic_asic_platform == "broadcom" %}
{%- if include_system_eventd == "y" and BUILD_REDUCE_IMAGE_SIZE == "y" %}
{% do features.append(("eventd","disabled", false, "enabled")) %}
{%- elif include_system_eventd == "y" %}
{% do features.append(("eventd", "enabled", false, "enabled")) %}
Expand Down
4 changes: 1 addition & 3 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-db-cli_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f


{% if include_system_eventd == "y" %}
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
{% if include_system_eventd == "y" and build_reduce_image_size != "y" %}
# Install sonic-rsyslog-plugin
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-rsyslog-plugin_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
Expand All @@ -345,7 +344,6 @@ sudo cp $BUILD_TEMPLATES/bgpd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/
j2 -f json $BUILD_TEMPLATES/rsyslog_plugin.conf.j2 $BUILD_TEMPLATES/syncd_events_info.json | sudo tee $FILESYSTEM_ROOT_ETC/rsyslog.d/syncd_events.conf
sudo cp $BUILD_TEMPLATES/syncd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/

{% endif %}
{% endif %}

# Install custom-built monit package and SONiC configuration files
Expand Down
11 changes: 7 additions & 4 deletions files/image_config/rsyslog/rsyslog.d/00-sonic.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,34 @@ template(name="prog_msg" type="list") {
constant(value="\n")
}

{% if include_system_eventd == "y" %}
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
{% if include_system_eventd == "y" and build_reduce_image_size != "y" %}

$ModLoad omprog

{% endif %}

if re_match($programname, "bgp[0-9]*#(frr|zebra|staticd|watchfrr)") then {
/var/log/frr/zebra.log
{% if include_system_eventd == "y" and build_reduce_image_size != "y" %}
action(type="omprog"
binary="/usr/bin/rsyslog_plugin -r /etc/rsyslog.d/zebra_regex.json -m sonic-events-bgp"
output="/var/log/rsyslog_plugin.log"
template="prog_msg")
{% endif %}
stop
}

if re_match($programname, "bgp[0-9]*#bgpd") then {
/var/log/frr/bgpd.log
{% if include_system_eventd == "y" and build_reduce_image_size != "y" %}
action(type="omprog"
binary="/usr/bin/rsyslog_plugin -r /etc/rsyslog.d/bgpd_regex.json -m sonic-events-bgp"
output="/var/log/rsyslog_plugin.log"
template="prog_msg")
{% endif %}
stop
}

{% endif %}
{% endif %}

## Teamd rules

Expand Down

0 comments on commit a1215f4

Please sign in to comment.