fabrica/packer/provisioning/alpine/syslog.sh

55 lines
1.4 KiB
Bash

#!/bin/sh
set -xe
source /root/provisioning/common.sh
installRsyslogRelp()
{
apk add --no-cache rsyslog-relp
}
installNodeExporter()
{
local node_exporter_version="0.18.1"
local node_exporter_archive="node_exporter-${node_exporter_version}.linux-amd64.tar.gz"
local node_exporter_url="https://github.com/prometheus/node_exporter/releases/download/v${node_exporter_version}/${node_exporter_archive}"
local node_exporter_sum="b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424"
cd /tmp
downloadArchive ${node_exporter_url} ${node_exporter_sum} ${node_exporter_archive} sha256sum
extractArchiveXZ ${node_exporter_archive} /srv/node_exporter
cd -
}
confSyslog()
{
SYSLOG_CONF_DIR="/etc/rsyslog.d/"
SYSLOG_CONF_FILE="${SYSLOG_CONF_DIR}/aggregation.conf"
QUEUE_DIR="/var/log/rsyslog/queues"
if [ ! -d ${SYSLOG_CONF_DIR} ]
then
mkdir ${SYSLOG_CONF_DIR}
fi
if [ ! -d ${QUEUE_DIR} ]
then
mkdir -p ${QUEUE_DIR}
fi
echo "\$WorkDirectory ${QUEUE_DIR}" >> ${SYSLOG_CONF_FILE}
echo "\$ActionQueueType LinkedList" >> ${SYSLOG_CONF_FILE}
echo "\$ActionQueueFileName send_all" >> ${SYSLOG_CONF_FILE}
echo "\$ActionQueueSaveOnShutdown on" >> ${SYSLOG_CONF_FILE}
echo "" >> ${SYSLOG_CONF_FILE}
echo "*.* :omrelp:${SYSLOG_SERVER}:${SYSLOG_PORT}" >> ${SYSLOG_CONF_FILE}
}
cat /etc/resolv.conf
#Not needed for ber
#installRsyslogRelp
#installNodeExporter
#confSyslog