Skip to content

Commit c75fd8b

Browse files
authored
CA-407370: Use remote.conf for customer rsyslog forwarding rules (#6328)
XenServer does not protect `/etc/rsyslog.d/xenserver.conf` when updating the rsyslog package (or the xenserver-release package on CH8.2CU1), as a result it is replaced with a fresh instance during updates which will lose customer configurations (if they have any). This script is primarily invoked via XenCenter when providing a new host for log forwarding. An update will be made to the XenServer rsyslog package to make it clear that `/etc/rsyslog.d/xenserver.conf` should not be edited by the customer. I've tested this by copying the updated script onto my DT box and using XenCenter to add a new log server - noting the new `/etc/rsyslog.d/custom.conf` file and the untouched `/etc/rsyslog.d/xenserver.conf` file.
2 parents 3a5b8d0 + 468eb75 commit c75fd8b

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

scripts/xe-syslog-reconfigure

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,12 @@ do
1414
shift
1515
done
1616

17-
if [ -r /etc/syslog.conf ]; then
18-
conf_file=/etc/syslog.conf
19-
service=syslog
20-
fi
21-
22-
if [ -r /etc/rsyslog.conf ]; then
23-
conf_file=/etc/rsyslog.conf
24-
service=rsyslog
25-
fi
26-
27-
if [ -r /etc/rsyslog.d/xenserver.conf ]; then
28-
conf_file=/etc/rsyslog.d/xenserver.conf
29-
service=rsyslog
30-
fi
31-
32-
if [ -z "$service" ]; then
33-
echo "Error: unable to determine syslog service" >&2
34-
exit 1
35-
fi
3617

37-
sed -e '/^\*\.\*.*[@~]/ d' $conf_file >/etc/syslog.$$
3818
if [ $remote -eq 1 ]; then
39-
echo -e "*.* @$host\n*.* ~" >>/etc/syslog.$$
19+
echo "# /etc/rsyslog.d/remote.conf is auto-generated by xe-syslog-reconfigure" > /etc/rsyslog.d/remote.conf
20+
echo "*.* @$host" >> /etc/rsyslog.d/remote.conf
4021
else
41-
echo "*.* ~" >>/etc/syslog.$$
22+
rm -f /etc/rsyslog.d/remote.conf
4223
fi
4324

44-
[ -s /etc/syslog.$$ ] && mv -f /etc/syslog.$$ $conf_file
45-
systemctl restart $service
25+
systemctl restart rsyslog

0 commit comments

Comments
 (0)