This commit is contained in:
Eliezer Croitoru 2024-01-07 23:34:40 +00:00
commit f0ee0d70e0
4 changed files with 49 additions and 0 deletions

6
0010-install-syslog-ng.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
apt update
apt install syslog-ng -y

25
Makefile Normal file
View File

@ -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

9
net-hosts.conf Normal file
View File

@ -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);};

9
remote_logs Normal file
View File

@ -0,0 +1,9 @@
/var/log/remote/*.log {
rotate 30
daily
dateext
compress
missingok
delaycompress
copytruncate
}