commit f0ee0d70e06d5533437964fe2d448b1ba6d3105c Author: Eliezer Croitoru Date: Sun Jan 7 23:34:40 2024 +0000 1 diff --git a/0010-install-syslog-ng.sh b/0010-install-syslog-ng.sh new file mode 100755 index 0000000..c7493f9 --- /dev/null +++ b/0010-install-syslog-ng.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +apt update +apt install syslog-ng -y + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5d4aeef --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +all: + echo OK + +install-dependencies: + bash 0001-install-deps.sh + +install-syslog-ng: + bash 0010-install-syslog-ng.sh + +configure-syslog-ng: + cp -vf net-hosts.conf /etc/syslog-ng/conf.d/net-hosts.conf + mkdir /var/log/remote -p + chown -Rv root:syslog /var/log/remote + systemctl reload syslog-ng + +configure-logrotate: + cp -vf remote_logs /etc/logrotate.d/remote_logs + +run-logrotate: + /usr/sbin/logrotate -v /etc/logrotate.d/remote_logs + +force-logrotate: + /usr/sbin/logrotate -vf /etc/logrotate.d/remote_logs + + diff --git a/net-hosts.conf b/net-hosts.conf new file mode 100644 index 0000000..66cc5a8 --- /dev/null +++ b/net-hosts.conf @@ -0,0 +1,9 @@ +source s_network_udp { syslog(ip(0.0.0.0) transport("udp") keep-hostname(no)); }; +source s_network_tcp { tcp(ip(0.0.0.0) port(514) keep-hostname(no)); }; + + +destination d_netlog { file("/var/log/remote/${HOST}.log"); }; + +log { source(s_network_udp); destination(d_netlog);}; +log { source(s_network_tcp); destination(d_netlog);}; + diff --git a/remote_logs b/remote_logs new file mode 100644 index 0000000..5998e4d --- /dev/null +++ b/remote_logs @@ -0,0 +1,9 @@ +/var/log/remote/*.log { + rotate 30 + daily + dateext + compress + missingok + delaycompress + copytruncate +}