3 # - relies on libs in /usr which is wrong
4 # (well, for modules bringing additional functionality it's acceptable IMO --q)
7 %bcond_with dynamic # link dynamically with glib, eventlog, pcre (modules are always linked dynamically)
8 %bcond_without sql # support for logging to SQL DB
9 %bcond_without tests # do not perform "make check"
10 %bcond_without json # support for JSON template formatting
11 %bcond_without mongodb # support for mongodb destination
12 %bcond_without redis # support for Redis destination
13 %bcond_without smtp # support for logging into SMTP
14 %bcond_without geoip # support for GeoIP
15 %bcond_without systemd # support for systemd
16 %bcond_without system_libivykis # use system libivykis
17 %bcond_with system_rabbitmq # use system librabbitmq [not supported yet]
19 %define glib2_ver 1:2.24.0
20 Summary: Syslog-ng - new generation of the system logger
21 Summary(pl.UTF-8): Syslog-ng - systemowy demon logujący nowej generacji
22 Summary(pt_BR.UTF-8): Daemon de log nova geração
26 License: GPL v2+ with OpenSSL exception
28 Source0: http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/%{version}/source/%{name}_%{version}.tar.gz
29 # Source0-md5: 6928e9be3499a2e9ae52ea8aa204b165
32 Source3: %{name}.logrotate
33 Source4: http://www.balabit.com/support/documentation/syslog-ng-ose-3.6-guides/en/syslog-ng-ose-v3.6-guide-admin/pdf/%{name}-ose-v3.6-guide-admin.pdf
34 # Source4-md5: bb12c18aef655096987911c4a9fe3ffa
35 Source5: %{name}-simple.conf
36 Patch0: %{name}-datadir.patch
37 Patch1: cap_syslog-vserver-workaround.patch
38 Patch2: %{name}-nolibs.patch
39 Patch3: %{name}-systemd.patch
40 Patch4: man-paths.patch
41 URL: http://www.balabit.com/products/syslog_ng/
42 %{?with_geoip:BuildRequires: GeoIP-devel >= 1.5.1}
43 BuildRequires: autoconf >= 2.53
44 BuildRequires: automake
45 BuildRequires: bison >= 2.4
46 BuildRequires: docbook-style-xsl
47 BuildRequires: eventlog-devel >= 0.2.12
48 %{?with_tests:BuildRequires: findutils}
50 BuildRequires: glib2-devel >= %{glib2_ver}
51 %{?with_redis:BuildRequires: hiredis-devel}
52 %{?with_json:BuildRequires: json-c-devel >= 0.9}
53 BuildRequires: libcap-devel
54 %{?with_sql:BuildRequires: libdbi-devel >= 0.8.3-2}
55 %{?with_smtp:BuildRequires: libesmtp-devel}
56 %{?with_system_libivykis:BuildRequires: libivykis-devel >= 0.36.1}
57 %{?with_mongodb:BuildRequires: libmongo-client-devel >= 0.1.6}
58 BuildRequires: libnet-devel >= 1:1.1.2.1-3
59 BuildRequires: libtool >= 2:2.0
60 BuildRequires: libwrap-devel
61 BuildRequires: openssl-devel >= 0.9.8
62 BuildRequires: pcre-devel >= 6.1
63 BuildRequires: pkgconfig
64 %{?with_system_rabbitmq:BuildRequires: rabbitmq-c-devel >= 0.0.1}
65 BuildRequires: rpm >= 4.4.9-56
66 BuildRequires: rpmbuild(macros) >= 1.623
69 %{?with_sql:BuildRequires: libdbi-drivers-sqlite3}
71 BuildRequires: python-modules
74 %if %{without dynamic}
75 BuildRequires: eventlog-static >= 0.2.12
76 BuildRequires: glib2-static >= %{glib2_ver}
77 %{?with_system_libivykis:BuildRequires: libivykis-static >= 0.36.1}
78 BuildRequires: pcre-static >= 6.1
79 BuildRequires: zlib-static
81 Requires(post): fileutils
82 Requires(post,preun): /sbin/chkconfig
84 Requires(post,preun,postun): systemd-units >= 38
86 Requires: %{name}-libs = %{version}-%{release}
87 Requires: eventlog >= 0.2.12
88 Requires: glib2 >= %{glib2_ver}
90 Requires: psmisc >= 20.1
91 %{?with_system_rabbitmq:Requires: rabbitmq-c >= 0.0.1}
92 Requires: rc-scripts >= 0.4.3.0
94 Requires: systemd-units >= 38
97 Requires: libnet >= 1:1.1.2.1-7
98 # for afsocket and dbparser
99 Requires: openssl >= 0.9.8
100 Provides: service(klogd)
101 Provides: service(syslog)
102 Provides: syslogdaemon
103 Obsoletes: syslog-ng-module-afsocket
104 Obsoletes: syslog-ng-module-dbparser
105 Obsoletes: syslog-ng-systemd
110 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
112 %define xsl_stylesheets_dir /usr/share/sgml/docbook/xsl-stylesheets
114 # syslog-ng has really crazy linking rules (see their bugzilla).
115 # Some rules, according to syslog-ng devs, are like this:
116 # - libsyslog-ng.so has undefined symbols for third party libraries
117 # and these symbols should go via main syslog-ng binary
118 # - same applies for modules
119 # In dynamic case tests are forcily linked with dynamic modules, which doesn't work with as-needed.
120 %define filterout_ld -Wl,--as-needed -Wl,--no-copy-dt-needed-entries
122 %if %{without dynamic}
123 %define no_install_post_check_so 1
124 %define _sbindir /sbin
125 %define _libdir /%{_lib}
129 syslog-ng is a syslogd replacement for Unix and Unix-like systems. It
130 has been tested on Solaris, BSDi and Linux, and were found to run
131 reliably. syslog-ng gives you a much enhanced configuration scheme,
132 which lets you filter messages based on not only priority/facility
133 pairs, but also on message content. You can use regexps to direct log
134 stream to different destinations. A destination can be anything from a
135 simple file to a network connection. syslog-ng supports TCP
136 logforwarding, together with hashing to prevent unauthorized
137 modification on the line.
139 %description -l pl.UTF-8
140 Syslog-ng jest zamiennikiem dla standardowo używanych programów typu
141 syslog. Działa w systemie SunOS, BSD, Linux. Daje znacznie większe
142 możliwości logowania i kontrolowania zbieranych informacji.
144 %description -l pt_BR.UTF-8
145 Syslog-ng é um substituto para o syslog tradicional, mas com diversas
146 melhorias, como, por exemplo, a habilidade de filtrar mensagens de log
147 por seu conteúdo (usando expressões regulares) e não apenas pelo par
148 facility/prioridade como o syslog original.
151 Summary: Upstart job description for syslog-ng
152 Summary(pl.UTF-8): Opis zadania Upstart dla demona syslog-ng
154 Requires: %{name} = %{version}-%{release}
155 Requires: upstart >= 0.6
156 Conflicts: avahi-upstart < 0.6.30-2
157 Conflicts: openssh-server-upstart < 2:5.8p2-2
158 Conflicts: postgresql-upstart < 9.0.4-2
161 Upstart job description for syslog-ng.
163 %description upstart -l pl.UTF-8
164 Opis zadania Upstart dla demona syslog-ng.
166 %package module-afmongodb
167 Summary: MongoDB destination support module for syslog-ng
168 Summary(pl.UTF-8): Moduł sysloga-ng do obsługi zapisu logów w bazie MongoDB
170 Requires: %{name} = %{version}-%{release}
171 Requires: libmongo-client >= 0.1.6
173 %description module-afmongodb
174 MongoDB destination support module for syslog-ng.
176 %description module-afmongodb -l pl.UTF-8
177 Moduł sysloga-ng do obsługi zapisu logów w bazie MongoDB.
179 %package module-afsmtp
180 Summary: SMTP output support module for syslog-ng
181 Summary(pl.UTF-8): Moduł sysloga-ng do obsługi wysyłania logów do serwerów SMTP
183 Requires: %{name} = %{version}-%{release}
184 Requires: openssl >= 0.9.8
186 %description module-afsmtp
187 SMTP output support module for syslog-ng.
189 %description module-afsmtp -l pl.UTF-8
190 Moduł sysloga-ng do obsługi wysyłania logów do serwerów SMTP.
192 %package module-afsql
193 Summary: SQL destination support module for syslog-ng
194 Summary(pl.UTF-8): Moduł sysloga-ng do obsługi zapisu logów w bazach SQL
196 Requires: %{name} = %{version}-%{release}
197 Requires: libdbi >= 0.8.3-2
198 Requires: openssl >= 0.9.8
200 %description module-afsql
201 SQL destination support module for syslog-ng (via libdbi).
203 %description module-afsql -l pl.UTF-8
204 Moduł sysloga-ng do obsługi zapisu logów w bazach SQL (poprzez
207 %package module-json-plugin
208 Summary: JSON formatting template function for syslog-ng
209 Summary(pl.UTF-8): Moduł sysloga-ng do obsługi szablonów z formatowaniem JSON
211 Requires: %{name} = %{version}-%{release}
212 Requires: json-c >= 0.9
213 Obsoletes: syslog-ng-module-tfjson
215 %description module-json-plugin
216 JSON formatting template function for syslog-ng.
218 %description module-json-plugin -l pl.UTF-8
219 Moduł sysloga-ng do obsługi szablonów z formatowaniem JSON.
221 %package module-redis
222 Summary: Redis destination support module for syslog-ng
223 Summary(pl.UTF-8): Moduł sysloga-ng do obsługi zapisu logów w bazie Redis
225 Requires: %{name} = %{version}-%{release}
227 %description module-redis
228 Redis destination support module for syslog-ng (via libhiredis).
230 %description module-redis -l pl.UTF-8
231 Moduł sysloga-ng do obsługi zapisu logów w bazie Redis (poprzez
234 %package module-tfgeoip
235 Summary: syslog-ng template function module to get GeoIP info from an IPv4 addresses
236 Summary(pl.UTF-8): Moduł funkcji szablonu sysloga-ng do pobierania informacji GeoIP z adresów IPv4
238 Requires: %{name} = %{version}-%{release}
239 Requires: GeoIP-libs >= 1.5.1
241 %description module-tfgeoip
242 syslog-ng template function module to get GeoIP info from an IPv4
245 %description module-tfgeoip -l pl.UTF-8
246 Moduł funkcji szablonu sysloga-ng do pobierania informacji GeoIP z
250 Summary: Shared library for syslog-ng
251 Summary(pl.UTF-8): Biblioteka współdzielona sysloga-ng
254 Requires: eventlog >= 0.2.12
255 Requires: glib2 >= %{glib2_ver}
256 %{?with_system_libivykis:Requires: libivykis >= 0.36.1}
257 Requires: pcre >= 6.1
259 Conflicts: syslog-ng < 3.3.1-3
262 Shared library for syslog-ng.
264 %description libs -l pl.UTF-8
265 Biblioteka współdzielona sysloga-ng.
268 Summary: Header files for syslog-ng modules development
269 Summary(pl.UTF-8): Pliki nagłówkowe do tworzenia modułów dla sysloga-ng
270 Group: Development/Libraries
271 Requires: %{name}-libs = %{version}-%{release}
273 Requires: eventlog-devel >= 0.2.12
274 Requires: glib2-devel >= %{glib2_ver}
275 %{?with_system_libivykis:Requires: libivykis-devel >= 0.36.1}
276 Requires: pcre-devel >= 6.1
280 Header files for syslog-ng modules development.
282 %description devel -l pl.UTF-8
283 Pliki nagłówkowe do tworzenia modułów dla sysloga-ng.
293 cp -p %{SOURCE5} contrib/syslog-ng.conf.simple
295 %{__sed} -i -e 's|/usr/bin/awk|/bin/awk|' scl/syslogconf/convert-syslogconf.awk
298 for i in . lib/ivykis; do
301 %{__aclocal} `[ -d m4 ] && echo '-I m4'`
308 --sysconfdir=%{_sysconfdir}/syslog-ng \
309 --datadir=%{_datadir}/syslog-ng \
310 --disable-silent-rules \
311 --with-default-modules=affile,afprog,afsocket,afuser,basicfuncs,csvparser,dbparser,syslogformat \
314 --with-libmongo-client=system \
318 %if %{with system_libivykis}
319 --with-ivykis=system \
321 --with-ivykis=internal \
323 %{?with_system_rabbitmq:--with-librabbitmq-client=system} \
324 --with-module-dir=%{_libdir}/syslog-ng \
325 --with-pidfile-dir=/var/run \
326 --with-timezone-dir=%{_datadir}/zoneinfo \
332 --with-systemdsystemunitdir=%{systemdunitdir} \
334 --enable-geoip%{!?with_geoip:=no} \
336 --enable-json%{!?with_json:=no} \
337 --enable-linux-caps \
340 --enable-redis%{!?with_redis:=no} \
341 --enable-smtp%{!?with_smtp:=no} \
342 --enable-spoof-source \
344 --enable-tcp-wrapper \
349 --enable-dynamic-linking
351 --enable-mixed-linking
355 XSL_STYLESHEET=%{xsl_stylesheets_dir}/manpages/docbook.xsl
358 LD_LIBRARY_PATH=$(find $PWD -name '*.so*' -printf "%h:")
359 PYTHONPATH=$(pwd)/tests/functional
360 export LD_LIBRARY_PATH PYTHONPATH
365 rm -rf $RPM_BUILD_ROOT
366 install -d $RPM_BUILD_ROOT/etc/{sysconfig,logrotate.d,rc.d/init.d,init} \
367 $RPM_BUILD_ROOT%{_sysconfdir}/syslog-ng/patterndb.d \
368 $RPM_BUILD_ROOT/var/{log,lib/%{name}/xsd}
370 %{__make} -j1 install \
371 pkgconfigdir=%{_pkgconfigdir} \
372 DESTDIR=$RPM_BUILD_ROOT
374 %{__sed} -e 's|@@SBINDIR@@|%{_sbindir}|g' %{SOURCE1} > $RPM_BUILD_ROOT/etc/rc.d/init.d/syslog-ng
375 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/syslog-ng/syslog-ng.conf
376 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/syslog-ng
378 for n in daemon debug iptables kernel lpr maillog messages secure spooler syslog user xferlog; do
379 > $RPM_BUILD_ROOT/var/log/$n
381 touch $RPM_BUILD_ROOT/etc/sysconfig/%{name}
383 %{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la
384 %{__rm} $RPM_BUILD_ROOT%{_libdir}/syslog-ng/*.la
387 rm -rf $RPM_BUILD_ROOT
390 if [ "$1" = "1" ]; then
391 # disable /proc/kmsg from config on first install on vserver
394 [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
395 done </proc/self/status
397 if [ -z "$ctx" -o "$ctx" = "0" ]; then
402 if [ "$VSERVER" = "yes" ]; then
403 %{__sed} -i -e '/\/proc\/kmsg/ s/^[^#]/#&/' %{_sysconfdir}/%{name}/%{name}.conf
407 /sbin/chkconfig --add syslog-ng
408 %service syslog-ng restart "syslog-ng daemon"
411 %systemd_post syslog-ng.service
415 if [ "$1" = "0" ]; then
416 %service syslog-ng stop
417 /sbin/chkconfig --del syslog-ng
420 %systemd_preun syslog-ng.service
428 %triggerpostun -- syslog-ng < 3.3.4-3
430 %systemd_trigger syslog-ng.service
433 %triggerun -- syslog-ng < 3.0
434 sed -i -e 's#sync(\(.*\))#flush_lines(\1)#g' /etc/syslog-ng/syslog-ng.conf
435 sed -i -e 's#pipe ("/proc/kmsg"#file ("/proc/kmsg"#g' /etc/syslog-ng/syslog-ng.conf
436 sed -i -e 's#log_prefix#program_override#g' /etc/syslog-ng/syslog-ng.conf
437 sed -i -e 's#^destination #destination d_#g' /etc/syslog-ng/syslog-ng.conf
438 sed -i -e 's#destination(#destination(d_#g' /etc/syslog-ng/syslog-ng.conf
439 sed -i -e 's,\bstats\b,stats_freq,' /etc/syslog-ng/syslog-ng.conf
440 sed -i -e 's#match("IN\=\[A-Za-z0-9\]\* OUT=\[A-Za-z0-9\]\*");#match("IN=[A-Za-z0-9]* OUT=[A-Za-z0-9]*" value("MESSAGE"));#g' /etc/syslog-ng/syslog-ng.conf
441 sed -i -e "1 s#\(.*\)\$#@version: 3.0\n\1#g" /etc/syslog-ng/syslog-ng.conf
442 rm -f %{_var}/lib/%{name}/syslog-ng.persist
443 %service -q syslog-ng restart
446 %post libs -p /sbin/ldconfig
447 %postun libs -p /sbin/ldconfig
450 %defattr(644,root,root,755)
451 %doc AUTHORS NEWS.md debian/syslog-ng.conf* contrib/relogger.pl
452 %doc contrib/syslog-ng.conf.{doc,simple,RedHat}
453 %doc contrib/{apparmor,selinux,syslog2ng} doc/syslog-ng-ose-v3.6-guide-admin.pdf
454 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
455 %attr(750,root,root) %dir %{_sysconfdir}/syslog-ng
456 %attr(750,root,root) %dir %{_sysconfdir}/syslog-ng/patterndb.d
457 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/scl.conf
458 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/syslog-ng.conf
459 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/syslog-ng
460 %attr(754,root,root) /etc/rc.d/init.d/syslog-ng
462 %{systemdunitdir}/syslog-ng.service
464 %dir %{_libdir}/syslog-ng
465 %attr(755,root,root) %{_libdir}/syslog-ng/libafamqp.so
466 %attr(755,root,root) %{_libdir}/syslog-ng/libaffile.so
467 %attr(755,root,root) %{_libdir}/syslog-ng/libafprog.so
468 %attr(755,root,root) %{_libdir}/syslog-ng/libafsocket.so
469 %attr(755,root,root) %{_libdir}/syslog-ng/libafsocket-notls.so
470 %attr(755,root,root) %{_libdir}/syslog-ng/libafsocket-tls.so
471 %attr(755,root,root) %{_libdir}/syslog-ng/libafstomp.so
472 %attr(755,root,root) %{_libdir}/syslog-ng/libafuser.so
473 %attr(755,root,root) %{_libdir}/syslog-ng/libbasicfuncs.so
474 %attr(755,root,root) %{_libdir}/syslog-ng/libconfgen.so
475 %attr(755,root,root) %{_libdir}/syslog-ng/libcryptofuncs.so
476 %attr(755,root,root) %{_libdir}/syslog-ng/libcsvparser.so
477 %attr(755,root,root) %{_libdir}/syslog-ng/libdbparser.so
478 %attr(755,root,root) %{_libdir}/syslog-ng/libgraphite.so
479 %attr(755,root,root) %{_libdir}/syslog-ng/liblinux-kmsg-format.so
480 %attr(755,root,root) %{_libdir}/syslog-ng/libpacctformat.so
481 %attr(755,root,root) %{_libdir}/syslog-ng/libpseudofile.so
483 %attr(755,root,root) %{_libdir}/syslog-ng/libsdjournal.so
485 %attr(755,root,root) %{_libdir}/syslog-ng/libsyslog-ng-crypto.so
486 %attr(755,root,root) %{_libdir}/syslog-ng/libsyslogformat.so
487 %attr(755,root,root) %{_libdir}/syslog-ng/libsystem-source.so
488 %attr(755,root,root) %{_sbindir}/syslog-ng
489 %attr(755,root,root) %{_sbindir}/syslog-ng-ctl
490 %attr(755,root,root) %{_bindir}/loggen
491 %attr(755,root,root) %{_bindir}/pdbtool
492 %attr(755,root,root) %{_bindir}/update-patterndb
494 %dir %{_datadir}/syslog-ng/include
495 %dir %{_datadir}/syslog-ng/include/scl
496 %dir %{_datadir}/syslog-ng/include/scl/graphite
497 %{_datadir}/syslog-ng/include/scl/graphite/README
498 %{_datadir}/syslog-ng/include/scl/graphite/plugin.conf
499 %dir %{_datadir}/syslog-ng/include/scl/nodejs
500 %{_datadir}/syslog-ng/include/scl/nodejs/plugin.conf
501 %dir %{_datadir}/syslog-ng/include/scl/pacct
502 %{_datadir}/syslog-ng/include/scl/pacct/plugin.conf
503 %dir %{_datadir}/syslog-ng/include/scl/rewrite
504 %{_datadir}/syslog-ng/include/scl/rewrite/cc-mask.conf
505 %dir %{_datadir}/syslog-ng/include/scl/syslogconf
506 %{_datadir}/syslog-ng/include/scl/syslogconf/README
507 %attr(755,root,root) %{_datadir}/syslog-ng/include/scl/syslogconf/convert-syslogconf.awk
508 %{_datadir}/syslog-ng/include/scl/syslogconf/plugin.conf
509 %dir %{_datadir}/syslog-ng/include/scl/system
510 %{_datadir}/syslog-ng/include/scl/system/plugin.conf
511 %dir %{_datadir}/syslog-ng/xsd
512 %{_datadir}/syslog-ng/xsd/patterndb-*.xsd
514 %dir %{_var}/lib/%{name}
515 %dir %{_var}/lib/%{name}/xsd
516 %{_mandir}/man1/loggen.1*
517 %{_mandir}/man1/pdbtool.1*
518 %{_mandir}/man1/syslog-ng-ctl.1*
519 %{_mandir}/man5/syslog-ng.conf.5*
520 %{_mandir}/man8/syslog-ng.8*
522 %attr(640,root,root) %ghost /var/log/daemon
523 %attr(640,root,root) %ghost /var/log/debug
524 %attr(640,root,root) %ghost /var/log/iptables
525 %attr(640,root,root) %ghost /var/log/kernel
526 %attr(640,root,root) %ghost /var/log/lpr
527 %attr(640,root,root) %ghost /var/log/maillog
528 %attr(640,root,root) %ghost /var/log/messages
529 %attr(640,root,root) %ghost /var/log/secure
530 %attr(640,root,root) %ghost /var/log/spooler
531 %attr(640,root,root) %ghost /var/log/syslog
532 %attr(640,root,root) %ghost /var/log/user
533 %attr(640,root,root) %ghost /var/log/xferlog
536 %files module-afmongodb
537 %defattr(644,root,root,755)
538 %attr(755,root,root) %{_libdir}/syslog-ng/libafmongodb.so
543 %defattr(644,root,root,755)
544 %attr(755,root,root) %{_libdir}/syslog-ng/libafsmtp.so
549 %defattr(644,root,root,755)
550 %attr(755,root,root) %{_libdir}/syslog-ng/libafsql.so
554 %files module-json-plugin
555 %defattr(644,root,root,755)
556 %attr(755,root,root) %{_libdir}/syslog-ng/libjson-plugin.so
561 %defattr(644,root,root,755)
562 %attr(755,root,root) %{_libdir}/syslog-ng/libredis.so
566 %files module-tfgeoip
567 %defattr(644,root,root,755)
568 %attr(755,root,root) %{_libdir}/syslog-ng/libtfgeoip.so
572 %defattr(644,root,root,755)
573 %attr(755,root,root) %{_libdir}/libsyslog-ng-*.so.*
574 %dir %{_datadir}/syslog-ng
577 %defattr(644,root,root,755)
578 %attr(755,root,root) %{_libdir}/libsyslog-ng.so
579 %{_includedir}/syslog-ng
580 %{_datadir}/syslog-ng/tools
581 %{_pkgconfigdir}/syslog-ng.pc