Skip to content

Commit b3d18dc

Browse files
Susant SahaniSusant Sahani
Susant Sahani
authored and
Susant Sahani
committed
initial commit
This is a standalone version of systemd-netlogd, extracted from the systemd repository as of commit ID 13317a2 This daemon Forwards messages from the journal to other hosts over the network using the Syslog Protocol (RFC 5424). It can be configured to send messages to both unicast and multicast addresses. systemd-netlogd runs with own user systemd-journal-netlog. Starts sending logs when network is up and stops sending as soon as network is down ( uses sd-network). Actually useful beyond the scope of systemd itself.
0 parents  commit b3d18dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+18812
-0
lines changed

.gitignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
*.a
2+
*.cache
3+
*.html
4+
*.la
5+
*.lo
6+
*.log
7+
*.o
8+
*.plist
9+
*.pyc
10+
*.stamp
11+
*.swp
12+
*.trs
13+
*~
14+
.config.args
15+
.deps/
16+
.dirstamp
17+
.libs/
18+
/*.gcda
19+
/*.gcno
20+
/*.tar.bz2
21+
/*.tar.gz
22+
/*.tar.xz
23+
/build-aux
24+
/libtool
25+
/Makefile
26+
/TAGS
27+
/GPATH
28+
/GRTAGS
29+
/GSYMS
30+
/GTAGS
31+
/systemd-netlogd
32+
Makefile.in
33+
aclocal.m4
34+
config.h
35+
config.h.in
36+
config.log
37+
config.status
38+
configure
39+
stamp-*

LICENSE.GPL2

+339
Large diffs are not rendered by default.

LICENSE.LGPL2.1

+502
Large diffs are not rendered by default.

Makefile.am

+287
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
# -*- Mode: makefile; indent-tabs-mode: t -*-
2+
#
3+
# This file is part of systemd-netlogd
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as published by
7+
# the Free Software Foundation; either version 2.1 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# systemd is distributed in the hope that it will be useful, but
11+
# WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
17+
18+
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
19+
AM_MAKEFLAGS = --no-print-directory
20+
AUTOMAKE_OPTIONS = color-tests parallel-tests
21+
22+
GCC_COLORS ?= 'ooh, shiny!'
23+
export GCC_COLORS
24+
25+
SUBDIRS = .
26+
27+
# remove targets if the command fails
28+
.DELETE_ON_ERROR:
29+
30+
# keep intermediate files
31+
.SECONDARY:
32+
33+
# Keep the test-suite.log
34+
.PRECIOUS: $(TEST_SUITE_LOG) Makefile
35+
36+
# Dirs of external packages
37+
systemdir=@systemdir@
38+
39+
# And these are the special ones for /
40+
rootprefix=@rootprefix@
41+
rootbindir=$(rootprefix)/bin
42+
rootlibexecdir=$(rootprefix)/lib/systemd
43+
pkgsysconfdir=$(sysconfdir)/systemd
44+
systemunitdir=$(rootprefix)/lib/systemd/system
45+
46+
AM_CFLAGS = $(OUR_CFLAGS)
47+
AM_LDFLAGS = $(OUR_LDFLAGS)
48+
AM_CPPFLAGS = \
49+
-include $(top_builddir)/config.h \
50+
-DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
51+
-DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" \
52+
-DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" \
53+
-DSYSTEMD_BINARY_PATH=\"$(rootlibexecdir)/systemd\" \
54+
-DROOTPREFIX=\"$(rootprefix)\" \
55+
-DLIBDIR=\"$(libdir)\" \
56+
-DROOTLIBDIR=\"$(rootlibdir)\" \
57+
-DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
58+
-DCATALOG_DATABASE=\"$(catalogstatedir)/database\" \
59+
-I $(top_srcdir)/src
60+
61+
#####################################################
62+
63+
dist_noinst_DATA = \
64+
LICENSE.LGPL2.1 \
65+
LICENSE.GPL2
66+
67+
EXTRA_DIST = \
68+
man/systemd-netlogd.conf.xml \
69+
man/custom-man.xsl \
70+
man/standard-conf.xml \
71+
man/standard-options.xml \
72+
units/systemd-netlogd.service.in \
73+
src/systemd-netlogd.conf.in
74+
75+
MANPAGES = man/systemd-netlogd.conf.5
76+
MANPAGES_ALIAS = man/systemd-netlogd.conf.d.5
77+
78+
man_MANS = $(MANPAGES) $(MANPAGES_ALIAS)
79+
80+
man/systemd-netlogd.conf.d.5: man/systemd-netlogd.conf.5
81+
82+
XSLTPROC_FLAGS = \
83+
--nonet \
84+
--xinclude \
85+
--stringparam man.output.quietly 1 \
86+
--stringparam funcsynopsis.style ansi \
87+
--stringparam man.authors.section.enabled 0 \
88+
--stringparam man.copyright.section.enabled 0 \
89+
--stringparam systemd.version $(VERSION) \
90+
--path '$(builddir)/man:$(srcdir)/man'
91+
92+
XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc)
93+
XSLTPROC_PROCESS_MAN = \
94+
$(AM_V_XSLT)$(XSLT) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
95+
96+
man/%.1: man/%.xml man/custom-man.xsl
97+
$(XSLTPROC_PROCESS_MAN)
98+
99+
man/%.5: man/%.xml man/custom-man.xsl
100+
$(XSLTPROC_PROCESS_MAN)
101+
102+
#------------------------------------------------------------------------------
103+
104+
libutils_la_SOURCES = \
105+
src/missing_syscall.h \
106+
src/missing.h \
107+
src/def.h \
108+
src/capability-util.c \
109+
src/capability-util.h \
110+
src/conf-parser.c \
111+
src/conf-parser.h \
112+
src/conf-files.c \
113+
src/conf-files.h \
114+
src/alloc-util.c \
115+
src/alloc-util.h \
116+
src/build.h \
117+
src/umask-util.h \
118+
src/set.h \
119+
src/hashmap.c \
120+
src/hashmap.h \
121+
src/siphash24.c \
122+
src/siphash24.h \
123+
src/utf8.c \
124+
src/utf8.h \
125+
src/strv.c \
126+
src/strv.h \
127+
src/network-util.c \
128+
src/network-util.h \
129+
src/in-addr-util.c \
130+
src/in-addr-util.h \
131+
src/extract-word.c \
132+
src/extract-word.h \
133+
src/util.c \
134+
src/util.h \
135+
src/log.c \
136+
src/log.h \
137+
src/macro.h \
138+
src/signal-util.c \
139+
src/signal-util.h \
140+
src/syslog-util.c \
141+
src/syslog-util.h \
142+
src/time-util.c \
143+
src/time-util.h \
144+
src/ioprio.h \
145+
src/io-util.c \
146+
src/io-util.h \
147+
src/escape.c \
148+
src/escape.h \
149+
src/user-util.c \
150+
src/user-util.h \
151+
src/process-util.c \
152+
src/process-util.h \
153+
src/terminal-util.c \
154+
src/terminal-util.h \
155+
src/proc-cmdline.c \
156+
src/proc-cmdline.h \
157+
src/socket-util.c \
158+
src/socket-util.h \
159+
src/dirent-util.c \
160+
src/dirent-util.h \
161+
src/fd-util.c \
162+
src/fd-util.h \
163+
src/sparse-endian.h \
164+
src/fileio.c \
165+
src/fileio.h \
166+
src/formats-util.h \
167+
src/hash-funcs.c \
168+
src/hash-funcs.h \
169+
src/hexdecoct.c \
170+
src/hexdecoct.h \
171+
src/list.h \
172+
src/mempool.c \
173+
src/mempool.h \
174+
src/parse-util.c \
175+
src/parse-util.h \
176+
src/path-util.c \
177+
src/path-util.h \
178+
src/random-util.c \
179+
src/random-util.h \
180+
src/stdio-util.h \
181+
src/string-table.c \
182+
src/string-table.h \
183+
src/string-util.c \
184+
src/string-util.h \
185+
src/unaligned.h \
186+
src/stat-util.c \
187+
src/stat-util.h \
188+
src/fs-util.c \
189+
src/fs-util.h \
190+
src/mkdir.c \
191+
src/mkdir.h \
192+
src/virt.c \
193+
src/virt.h \
194+
src/sd-network.h \
195+
src/sd-network.c
196+
197+
libutils_la_CFLAGS = \
198+
$(AM_CFLAGS) \
199+
$(CAP_CFLAGS) \
200+
-pthread
201+
202+
libutils_la_LIBADD = \
203+
$(CAP_LIBS) \
204+
-lrt \
205+
-lm \
206+
-lsystemd
207+
208+
if HAVE_XZ
209+
libutils_la_CFLAGS += \
210+
$(XZ_CFLAGS)
211+
libutils_la_LIBADD += \
212+
$(XZ_LIBS)
213+
endif
214+
215+
noinst_LTLIBRARIES = libutils.la
216+
217+
#-------------------------------------------------------------
218+
219+
systemd_netlogd_SOURCES = \
220+
src/systemd-netlogd.c \
221+
src/netlog-conf.h \
222+
src/netlog-conf.c \
223+
src/netlog-manager.c \
224+
src/netlog-manager.h \
225+
src/netlog-network.c
226+
227+
systemd_netlogd_LDADD = \
228+
$(CAP_LIBS) \
229+
libutils.la
230+
231+
nodist_systemd_netlogd_SOURCES = \
232+
src/netlog-gperf.c
233+
234+
EXTRA_DIST += \
235+
src/netlog-gperf.gperf
236+
237+
CLEANFILES = \
238+
src/netlog-gperf.c
239+
240+
#--------------------------------
241+
242+
substitutions = \
243+
'|rootlibexecdir=$(rootlibexecdir)|'
244+
245+
SED_PROCESS = \
246+
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
247+
$(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
248+
< $< > $@
249+
250+
units/%: units/%.in
251+
$(SED_PROCESS)
252+
253+
src/%: src/%.in
254+
$(SED_PROCESS)
255+
256+
man/%: man/%.in
257+
$(SED_PROCESS)
258+
259+
src/%.c: src/%.gperf
260+
$(AM_V_at)$(MKDIR_P) $(dir $@)
261+
$(AM_V_GPERF)$(GPERF) < $< > $@
262+
263+
rootlibexec_PROGRAMS = systemd-netlogd
264+
dist_pkgsysconf_DATA = src/systemd-netlogd.conf
265+
nodist_systemunit_DATA = units/systemd-netlogd.service
266+
267+
in_files = $(filter %.in,$(EXTRA_DIST))
268+
269+
CLEANFILES += \
270+
$(MANPAGES) $(MANPAGES_ALIAS) \
271+
$(pkgconfigdata_DATA) \
272+
$(pkgconfiglib_DATA) \
273+
$(in_files:.in=)
274+
275+
install-exec-hook: $(INSTALL_EXEC_HOOKS)
276+
277+
uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS)
278+
279+
install-data-hook: $(INSTALL_DATA_HOOKS)
280+
281+
.PHONY: git-tag
282+
git-tag:
283+
git tag -s "v$(VERSION)" -m "systemd $(VERSION)"
284+
285+
.PHONY: git-tar
286+
git-tar:
287+
git archive --format=tar --prefix=systemd-$(VERSION)/ HEAD | xz > systemd-$(VERSION).tar.xz

README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
systemd-netlogd
2+
===================
3+
4+
Forwards messages from the journal to other hosts over the network using
5+
the Syslog Protocol (RFC 5424). It can be configured to send messages to
6+
both unicast and multicast addresses. systemd-netlogd runs with own user
7+
systemd-journal-netlog. Starts sending logs when network is up and stops
8+
sending as soon as network is down (uses sd-network).
9+
10+
-------------
11+
12+
Configuration
13+
-------------
14+
15+
Create a user **systemd-journal-netlog**
16+
> - useradd -G systemd-journal systemd-journal-netlog
17+
18+
19+
**[NETWORK]** SECTION OPTIONS
20+
21+
22+
The "[Network]" section only applies for UDP multicast address and Port:
23+
24+
Address=
25+
Controls whether log messages received by the systemd daemon shall be forwarded
26+
to a unicast UDP address or multicast UDP network group in syslog RFC 5424 format.
27+
28+
The the address string format is similar to socket units. See systemd.socket(1)
29+
30+
**EXAMPLE**
31+
32+
Example 1. /etc/systemd/systemd-netlogd.conf
33+
34+
[Network]
35+
Address=239.0.0.1:6000
36+
37+
Example 2. /etc/systemd/systemd-netlogd.conf
38+
39+
[Network]
40+
Address=192.168.8.101:514

TODO

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- remove unused code
2+
- support TCP ?

0 commit comments

Comments
 (0)