Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: Receiving syslog entries over network with systemd
Date: Sat, 06 May 2017 19:42:21
Message-Id: 64e3f53e-5c68-fde4-2db3-fb0e4de75fce@gmail.com
In Reply to: [gentoo-user] Re: Receiving syslog entries over network with systemd by Mick
1 On 06/05/2017 19:41, Mick wrote:
2 > On Thursday 04 May 2017 15:35:58 Mick wrote:
3 >> Hi All,
4 >>
5 >> I hope this post is not completely off topic. I have a small LAN server
6 >> (with Kodi) running systemd and I want to use it to receive and store
7 >> syslog entries from other devices over the LAN. I want to keep this system
8 >> as lightweight as possible, due to its constrained hardware. What is the
9 >> best way to go about it and how should I configure systemd? Please be
10 >> detailed with your explanations on systemd - my knowledge on this init
11 >> system and its manifold applications is quite limited.
12 >
13 > It was straight forward. Install syslog-ng, add a configuration to accept
14 > logs over UDP and install logrotate, which brought in cron and configured the
15 > required cron job.
16 >
17 > This is the additional configuration file I had to create:
18 >
19 > $ cat /etc/syslog-ng/conf.d/remote.conf
20 > source net { source net { udp(); };
21 > destination remote { file("/var/log/remote/${FULLHOST}-log"); };
22 > log { source(net); destination(remote); };
23 >
24 > I also tried this stanza to bind a LAN IP address for the syslog-ng host to
25 > listen to for connections from the LAN devices, but then syslog-ng failed to
26 > start:
27 >
28 > source net { syslog(ip(192.168.1.25) transport ("udp")); };
29 >
30 > Perhaps the ethernet was not up at the time and after a few attempts syslog-ng
31 > gave up. I was able to start it manually after boot though.
32 >
33
34 You might need to tweak your startup order in conf.d
35 a syslogger normally starts very early in the boot process, before even
36 networking so that it can log network-y errors.
37
38 A remote syslogger needs to start after networking.
39
40 --
41 Alan McKinnon
42 alan.mckinnon@×××××.com