Skip to content

Commit cb4c66a

Browse files
authored
[chassis][multiasic] fixed rsyslogd FATAL issue in the database container in multi-asic box (#8390)
Why I did it Fix for issue #8389 How I did it The /etc/rsyslog.conf is empty file which cause the FATAL of the process rsyslogd in the global instance database container. The function updateSyslogConf() should only generate the rsyslog.conf for containers in the namespace. it should not do it for the containers in the global instance. Instead, default rsyslog.conf should be used. Especially for database container, updateSyslogConf() is called before the database container is created. The result cause the sonic-cfggen failed to generate the rsyslog.conf.Why I did it Fix for issue #8389 How I did it The /etc/rsyslog.conf is empty file which cause the FATAL of the process rsyslogd in the global instance database container. The function updateSyslogConf() should only generate the rsyslog.conf for containers in the namespace. it should not do it for the containers in the global instance. Instead, default rsyslog.conf should be used. Especially for database container, updateSyslogConf() is called before the database container is created. The result cause the sonic-cfggen failed to generate the rsyslog.conf. Signed-off-by: mlok <[email protected]>
1 parent f2ee94d commit cb4c66a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

files/build_templates/docker_image_ctl.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ function updateSyslogConf()
3636
TARGET_IP=$(docker network inspect bridge --format={{ "'{{(index .IPAM.Config 0).Gateway}}'" }})
3737
CONTAINER_NAME="$DOCKERNAME"
3838
TMP_FILE="/tmp/rsyslog.$CONTAINER_NAME.conf"
39-
39+
{%- if docker_container_name == "database" %}
40+
python -c "import jinja2, os; paths=['/usr/share/sonic/templates']; loader = jinja2.FileSystemLoader(paths); env = jinja2.Environment(loader=loader, trim_blocks=True); template_file='/usr/share/sonic/templates/rsyslog-container.conf.j2'; template = env.get_template(os.path.basename(template_file)); data=template.render({\"target_ip\":\"$TARGET_IP\",\"container_name\":\"$CONTAINER_NAME\"}); print(data)" > $TMP_FILE
41+
{%- else %}
4042
sonic-cfggen -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\" }" > $TMP_FILE
43+
{%- endif %}
4144
docker cp $TMP_FILE ${DOCKERNAME}:/etc/rsyslog.conf
4245
rm -rf $TMP_FILE
4346
fi

0 commit comments

Comments
 (0)