feat: add config option for remote syslog

This commit is contained in:
Roni Väyrynen
2023-01-15 12:59:01 +02:00
parent 8902d70422
commit e800807908
2 changed files with 13 additions and 0 deletions

View File

@@ -106,3 +106,9 @@ PRESERVE="3"
# options: true/false
# default: true
#INSTALL_REPOS="true"
# Send xo-server logs to remote syslog
# syntax is: <protocol>://<target-address>:<port>
# supported protocols are udp and tcp
# example: tcp://syslog.company.lan:514
#SYSLOG_TARGET=""

View File

@@ -47,6 +47,7 @@ ACME_CA="${ACME_CA:-"letsencrypt/production"}"
USESUDO="${USESUDO:-"false"}"
GENSUDO="${GENSUDO:-"false"}"
INSTALL_REPOS="${INSTALL_REPOS:-"true"}"
SYSLOG_TARGET="${SYSLOG_TARGET:-""}"
# set variables not changeable in configfile
TIME=$(date +%Y%m%d%H%M)
@@ -803,6 +804,12 @@ function InstallXO {
runcmd "chown -R $XOUSER:$XOUSER $INSTALLDIR/mounts"
fi
if [[ -n "$SYSLOG_TARGET" ]]; then
printinfo "Enabling remote syslog in xo-server configuration file"
runcmd "sed -i \"s%#\[logs.transport.syslog\]%\[logs.transport.syslog\]%\" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml"
runcmd "sed -i \"/^\[logs.transport.syslog.*/a target = '$SYSLOG_TARGET'\" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml"
fi
printinfo "Activating modified configuration file"
runcmd "mkdir -p $CONFIGPATH/.config/xo-server"
runcmd "mv -f $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/sample.config.toml $CONFIGPATH/.config/xo-server/config.toml"