This commit is contained in:
42
run.sh
Normal file
42
run.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
# you need to specify this
|
||||
TARGET_HOST=${TARGET_HOST:-127.0.0.1}
|
||||
|
||||
# tcp (default) | udp
|
||||
TARGET_PROTO=${TARGET_PROTO:-tcp}
|
||||
|
||||
# 514 is the common default
|
||||
TARGET_PORT=${TARGET_PORT:-514}
|
||||
|
||||
cat >/etc/rsyslog.conf <<EOF
|
||||
\$WorkDirectory /var/lib/rsyslog
|
||||
|
||||
# Sets default permissions for all log files.
|
||||
\$FileOwner root
|
||||
\$FileGroup adm
|
||||
\$FileCreateMode 0640
|
||||
\$DirCreateMode 0755
|
||||
\$Umask 0022
|
||||
|
||||
module(load="imudp")
|
||||
input(type="imudp" port="514" )
|
||||
|
||||
module(load="imtcp")
|
||||
input(type="imtcp" port="514" )
|
||||
|
||||
module(load="mmutf8fix")
|
||||
action(type="mmutf8fix" replacementChar="?" )
|
||||
EOF
|
||||
|
||||
if [ "${TARGET_PROTO}" = "udp" ] ; then
|
||||
cat >>/etc/rsyslog.conf <<EOF
|
||||
action(type="omfwd" protocol="udp" target="${TARGET_HOST}" port="${TARGET_PORT}" Template="RSYSLOG_SyslogRFC5424Format" )
|
||||
EOF
|
||||
else
|
||||
cat >>/etc/rsyslog.conf <<EOF
|
||||
action(type="omfwd" protocol="tcp" target="${TARGET_HOST}" port="${TARGET_PORT}" Template="RSYSLOG_SyslogRFC5424Format" TCP_Framing="octet-counted" KeepAlive="on" )
|
||||
EOF
|
||||
fi
|
||||
|
||||
/usr/sbin/rsyslogd -nf /etc/rsyslog.conf
|
||||
Reference in New Issue
Block a user