From fa7c4abc95dd1f390ec9e53055209f6b0c84953e Mon Sep 17 00:00:00 2001 From: Matthias Runge Date: Tue, 26 Apr 2011 22:37:48 +0200 Subject: [PATCH] - drop support for fedora versions without systemd - incorporate all changes made in rawhide branch - rename files, delete unnecessary files - provide native systemd service file --- sysklogd-1.4.1-44-logrotate.d-syslog.log | 7 - sysklogd-1.4.1-logrotate.d-syslog.log | 6 - sysklogd-syslog-ng.sysconfig | 3 - syslog-ng.conf | 2 +- syslog-ng.init.d | 123 -------------- ...otate.d-rsyslog.log => syslog-ng.logrotate | 0 syslog-ng.service | 11 ++ syslog-ng.spec | 155 +++++++----------- ...g-ng-fc10.sysconfig => syslog-ng.sysconfig | 0 syslog-ng.vim | 52 ------ 10 files changed, 75 insertions(+), 284 deletions(-) delete mode 100644 sysklogd-1.4.1-44-logrotate.d-syslog.log delete mode 100644 sysklogd-1.4.1-logrotate.d-syslog.log delete mode 100644 sysklogd-syslog-ng.sysconfig delete mode 100644 syslog-ng.init.d rename rsyslog-3.21.9-logrotate.d-rsyslog.log => syslog-ng.logrotate (100%) create mode 100644 syslog-ng.service rename rsyslog-syslog-ng-fc10.sysconfig => syslog-ng.sysconfig (100%) delete mode 100644 syslog-ng.vim diff --git a/sysklogd-1.4.1-44-logrotate.d-syslog.log b/sysklogd-1.4.1-44-logrotate.d-syslog.log deleted file mode 100644 index 5e94409..0000000 --- a/sysklogd-1.4.1-44-logrotate.d-syslog.log +++ /dev/null @@ -1,7 +0,0 @@ -/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron { - sharedscripts - postrotate - /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true - /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true - endscript -} diff --git a/sysklogd-1.4.1-logrotate.d-syslog.log b/sysklogd-1.4.1-logrotate.d-syslog.log deleted file mode 100644 index b2d41f1..0000000 --- a/sysklogd-1.4.1-logrotate.d-syslog.log +++ /dev/null @@ -1,6 +0,0 @@ -/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron { - sharedscripts - postrotate - /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true - endscript -} diff --git a/sysklogd-syslog-ng.sysconfig b/sysklogd-syslog-ng.sysconfig deleted file mode 100644 index f0c36b0..0000000 --- a/sysklogd-syslog-ng.sysconfig +++ /dev/null @@ -1,3 +0,0 @@ -SYSLOGNG_PID="/var/run/syslog-ng.pid" -SYSLOGNG_OPTIONS="-p $SYSLOGNG_PID" -SYSLOGNG_COMPAT_PID="/var/run/syslogd.pid" diff --git a/syslog-ng.conf b/syslog-ng.conf index 11bc10a..28cbe68 100644 --- a/syslog-ng.conf +++ b/syslog-ng.conf @@ -1,4 +1,4 @@ -@version:3.0 +@version:3.2 # syslog-ng configuration file. # diff --git a/syslog-ng.init.d b/syslog-ng.init.d deleted file mode 100644 index eafaf4c..0000000 --- a/syslog-ng.init.d +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh -# -# syslog-ng starts/stops syslog-ng service -# -# chkconfig: - 12 88 -# description: Syslog is the facility by which many daemons use to log \ -# messages to various system log files. -# - -### BEGIN INIT INFO -# Provides: $syslog -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Short-Description: Next-generation syslog server -# Description: syslog-ng, as the name shows, is a syslogd replacement, but -# with new functionality for the new generation. The original syslogd -# allows messages only to be sorted based on priority/facility pairs; -# syslog-ng adds the possibility to filter based on message contents -# using regular expressions. The new configuration scheme is intuitive -# and powerful. Forwarding logs over TCP and remembering all forwarding -# hops makes it ideal for firewalled environments. -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -[ -e /etc/sysconfig/syslog-ng ] && . /etc/sysconfig/syslog-ng - -RETVAL=0 - -check_syntax() -{ - [ -x /sbin/syslog-ng ] || exit 5 - syslog-ng -s $SYSLOGNG_OPTIONS - RETVAL=$? - return $RETVAL -} - -verify_config() -{ - check_syntax - RETVAL=$? - [ $RETVAL -eq 0 ] || exit $retval -} - -checkconfig() -{ - action $"Checking Configuration: " check_syntax -} - -start() -{ - verify_config - echo -n $"Starting syslog-ng: " - if [ -e $SYSLOGNG_COMPAT_PID ]; then - failure "PID file for existing syslog daemon exists" - fi - daemon syslog-ng $SYSLOGNG_OPTIONS - ln -sf $SYSLOGNG_PID $SYSLOGNG_COMPAT_PID - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/syslog-ng - return $RETVAL -} - -stop() -{ - echo -n $"Stopping syslog-ng: " - REMOVE_COMPAT_PID=0 - if [ -e $SYSLOGNG_PID ]; then - if [ -e $SYSLOGNG_COMPAT_PID -a $(<$SYSLOGNG_PID) == $(<$SYSLOGNG_COMPAT_PID) ]; then - REMOVE_COMPAT_PID=1 - fi - fi - killproc syslog-ng - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/syslog-ng - [ $RETVAL -eq 0 -a $REMOVE_COMPAT_PID -eq 1 ] && rm -f $SYSLOGNG_COMPAT_PID - return $RETVAL -} - -reload() -{ - verify_config - echo -n $"Reloading syslog-ng: " - killproc syslog-ng -HUP - RETVAL=$? - echo - return $RETVAL -} - -restart() -{ - stop - start -} - - -case "$1" in - start|stop|reload) - $1 - ;; - restart|force_reload) - restart - ;; - status) - status syslog-ng - ;; - checkconfig|configtest|check|test) - checkconfig - ;; - condrestart|try-restart) - [ -f /var/lock/subsys/syslog-ng ] && restart || : - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|condrestart|checkconfig}" - exit 1 -esac - -exit $? - -# vim: ft=sh:ts=4:ai:si: diff --git a/rsyslog-3.21.9-logrotate.d-rsyslog.log b/syslog-ng.logrotate similarity index 100% rename from rsyslog-3.21.9-logrotate.d-rsyslog.log rename to syslog-ng.logrotate diff --git a/syslog-ng.service b/syslog-ng.service new file mode 100644 index 0000000..3bb2054 --- /dev/null +++ b/syslog-ng.service @@ -0,0 +1,11 @@ +[Unit] +Description=Syslog-ng System Logging Service + +[Service] +EnvironmentFile=-/etc/sysconfig/syslog-ng +ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service +ExecStart=/sbin/syslog-ng $SYSLOGNG_OPTIONS +Sockets=syslog-ng.socket + +[Install] +WantedBy=multi-user.target diff --git a/syslog-ng.spec b/syslog-ng.spec index c1713e2..d4d8502 100644 --- a/syslog-ng.spec +++ b/syslog-ng.spec @@ -1,5 +1,5 @@ -%{?_with_spoofsource:%define spoofsource 1} %define evtlog_ver 0.2.12 +%define gitsnapshot 20110424 %define _sbindir /sbin %define _localstatedir /var/lib/syslog-ng @@ -7,8 +7,8 @@ %define system_service /lib/systemd/system Name: syslog-ng -Version: 3.2.2 -Release: 3%{?dist} +Version: 3.2.3 +Release: 0.%{gitsnapshot}.2%{?dist} Summary: Next-generation syslog server Group: System Environment/Daemons @@ -17,53 +17,49 @@ Url: http://www.balabit.com/products/syslog_ng/ # git clone git://git.balabit.hu/bazsi/syslog-ng-3.2.git/ # cd syslog-ng-3.2/ -# git archive --format=tar --prefix="syslog-ng-3.2.2/" HEAD . | bzip2 > ../syslog-ng-3.2.2.tar.bz2 +# git archive --format=tar --prefix="syslog-ng-3.2.3/" HEAD . | bzip2 > ../syslog-ng-3.2.3-20110424.tar.bz2 #Source0: http://www.balabit.com/downloads/files/%{name}/open-source-edition/%{version}/source/%{name}_%{version}.tar.gz -Source0: %{name}-%{version}.tar.bz2 +Source0: %{name}-%{version}-%{gitsnapshot}.tar.bz2 Source1: syslog-ng.conf -Source2: syslog-ng.init.d -Source3: syslog-ng.service -Source10: sysklogd-syslog-ng.sysconfig -Source12: sysklogd-1.4.1-44-logrotate.d-syslog.log -Source30: rsyslog-syslog-ng-fc10.sysconfig -Source31: rsyslog-3.21.9-logrotate.d-rsyslog.log - +Source2: syslog-ng.service +Source3: syslog-ng.sysconfig +Source4: syslog-ng.logrotate BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: eventlog-devel >= %{evtlog_ver} BuildRequires: pkgconfig -BuildRequires: glib2-devel >= 2.10.1 -BuildRequires: pcre-devel >= 7.3 -BuildRequires: openssl-devel -BuildRequires: libdbi-devel - BuildRequires: libtool BuildRequires: automake BuildRequires: autoconf BuildRequires: bison BuildRequires: flex -BuildRequires: eventlog-devel -BuildRequires: tcp_wrappers-devel +BuildRequires: eventlog-devel >= %{evtlog_ver} +BuildRequires: glib2-devel >= 2.10.1 +BuildRequires: libdbi-devel BuildRequires: libnet-devel -Requires: logrotate -Requires(post): /sbin/chkconfig -Requires(preun): /sbin/chkconfig -Requires(preun): /sbin/service -Requires(postun): /sbin/service +BuildRequires: openssl-devel +BuildRequires: pcre-devel >= 7.3 +BuildRequires: tcp_wrappers-devel +Requires: logrotate +Requires(post): /bin/systemctl +Requires(preun): /bin/systemctl +Requires(preun): /bin/systemctl +Requires(postun): /bin/systemctl + +Provides: syslog # merge separate syslog-vim package into one Provides: syslog-ng-vim = %{version}-%{release} Obsoletes: syslog-ng-vim < 2.0.8-1 %description -syslog-ng, as the name shows, is a syslogd replacement, but with new -functionality for the new generation. The original syslogd allows -messages only to be sorted based on priority/facility pairs; syslog-ng -adds the possibility to filter based on message contents using regular -expressions. The new configuration scheme is intuitive and powerful. -Forwarding logs over TCP and remembering all forwarding hops makes it +syslog-ng, as the name shows, is a syslogd replacement, but with new +functionality for the new generation. The original syslogd allows +messages only to be sorted based on priority/facility pairs; syslog-ng +adds the possibility to filter based on message contents using regular +expressions. The new configuration scheme is intuitive and powerful. +Forwarding logs over TCP and remembering all forwarding hops makes it ideal for firewalled environments. %package devel @@ -71,7 +67,7 @@ Summary: Development files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} -%description devel +%description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. @@ -79,30 +75,17 @@ developing applications that use %{name}. %prep %setup -q -./autogen.sh - # fix perl path %{__sed} -i 's|^#!/usr/local/bin/perl|#!%{__perl}|' contrib/relogger.pl - -%define logrotated_dst syslog-ng -%if 0%{?rhel} - %if 0%{?rhel} >= 5 - %define sysconfig_src %{SOURCE10} - %define logrotated_src %{SOURCE12} - %endif -%endif -%if 0%{?fedora} - %if 0%{?fedora} < 15 - %define sysconfig_src %{SOURCE10} - %else - %define sysconfig_src %{SOURCE30} - %endif - %define logrotated_src %{SOURCE31} -%endif +# fix executable perms on contrib files +%{__chmod} -c a-x contrib/syslog2ng %build + +./autogen.sh + %configure \ --prefix=/ \ --libdir=/%{_lib} \ @@ -133,21 +116,14 @@ make DESTDIR=%{buildroot} install %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/%{name} %{__install} -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/syslog-ng.conf -# install init script for fedora <=14 -%if 0%{?fedora} < 15 -%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/init.d -%{__install} -p -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/%{name} -%else -# install systemd native file +# install init script +%{__install} -p -D -m 644 %{SOURCE2} %{buildroot}/%{system_service}/%{name}.service -%{__install} -p -D -m 644 %{SOURCE3} %{buildroot}/%{system_service}/%{name}.service -%endif %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig -%{__install} -p -m 644 %{sysconfig_src} %{buildroot}%{_sysconfdir}/sysconfig/%{name} +%{__install} -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d -%{__install} -p -m 644 %{logrotated_src} \ - %{buildroot}%{_sysconfdir}/logrotate.d/%{logrotated_dst} +%{__install} -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/syslog # make local state dir %{__install} -d -m 755 %{buildroot}/%{_localstatedir} @@ -156,9 +132,6 @@ make DESTDIR=%{buildroot} install /usr/bin/iconv -f iso8859-1 -t utf-8 AUTHORS > AUTHORS.conv && \ %{__mv} -f AUTHORS.conv AUTHORS -# fix executable perms on contrib files -%{__chmod} -x contrib/relogger.pl -%{__chmod} -x contrib/syslog2ng # install vim files @@ -181,33 +154,19 @@ rm -rf %{buildroot} %post /sbin/ldconfig -%if 0%{?fedora} < 15 - /sbin/chkconfig --add %{name} -%else - /bin/systemctl enable %{name}.service -%endif +/bin/systemctl enable %{name}.service %preun if [ "$1" = 0 ]; then - %if 0%{?fedora} < 15 - /sbin/service %{name} stop > /dev/null 2>&1 - /sbin/chkconfig --del %{name} - %else - /bin/systemctl stop %{name}.service - /bin/systemctl disable %{name}.service - %endif +/bin/systemctl stop %{name}.service +/bin/systemctl disable %{name}.service fi %postun /sbin/ldconfig if [ "$1" -ge 1 ]; then - %if 0%{?fedora} < 15 - /sbin/service %{name} condrestart >/dev/null 2>&1 - %else - /bin/systemctl condrestart %{name}.service - %endif - +/bin/systemctl condrestart %{name}.service fi @@ -233,7 +192,7 @@ fi %files -%defattr(-,root,root) +%defattr(-,root,root,-) %doc AUTHORS COPYING README ChangeLog NEWS %doc doc/security/*.txt %doc doc/examples/syslog-ng.conf.sample @@ -243,12 +202,8 @@ fi %config(noreplace) %{_sysconfdir}/%{name}/modules.conf %config(noreplace) %{_sysconfdir}/%{name}/scl.conf %config(noreplace) %{_sysconfdir}/sysconfig/%{name} -%config(noreplace) %{_sysconfdir}/logrotate.d/%{logrotated_dst} -%if 0%{?fedora} < 15 -%{_sysconfdir}/init.d/%{name} -%else +%config(noreplace) %{_sysconfdir}/logrotate.d/syslog %{system_service}/%{name}.service -%endif %dir %{_localstatedir} %{_sbindir}/%{name} @@ -263,9 +218,11 @@ fi # uhm, some better places for those? %{_datadir}/xsd -%{_mandir}/man1/* -%{_mandir}/man5/* -%{_mandir}/man8/* +%{_mandir}/man1/loggen.1* +%{_mandir}/man1/pdbtool.1* +%{_mandir}/man1/syslog-ng-ctl.1* +%{_mandir}/man5/syslog-ng.conf.5* +%{_mandir}/man8/syslog-ng.8* %ghost %{_datadir}/vim/ %files devel @@ -275,10 +232,24 @@ fi %changelog +* Tue Apr 26 2011 Matthias Runge - 3.2.3-0.20110424.2 +- drop support for fedora without systemd + +* Mon Apr 25 2011 Jose Pedro Oliveira - 3.2.3-0.20110424.1 +- change NVR to alert users that we have been using a syslog-ng v3.2 git snapshot + (for systemd support) + +* Mon Apr 25 2011 Jose Pedro Oliveira - 3.2.2-4 +- re-introduces the "Provides: syslog" (#651823 comments 13, 15 and 21) +- rename the logrotate.d file back to syslog (#651823 comments 12, 15, 16 and 21) +- cleans the sysconfig and logrotate file mess (#651823 comments 17, 20 and 21) +- spec code cleanup (#651823 comments 10 and 11) +- dropped duplicated eventlog-devel BR + * Thu Apr 21 2011 Matthias Runge - 3.2.2-3 - systemd fixup - more spec file cleanup, -- incorporate fixes from Jose Pedro Oliveira +- incorporate fixes from Jose Pedro Oliveira (#651823 comments 7 and 8) * Wed Apr 20 2011 Matthias Runge - 3.2.2-2 - spec cleanup diff --git a/rsyslog-syslog-ng-fc10.sysconfig b/syslog-ng.sysconfig similarity index 100% rename from rsyslog-syslog-ng-fc10.sysconfig rename to syslog-ng.sysconfig diff --git a/syslog-ng.vim b/syslog-ng.vim deleted file mode 100644 index d0ef3df..0000000 --- a/syslog-ng.vim +++ /dev/null @@ -1,52 +0,0 @@ -" Vim syntax file -" Language: syslog-ng: syslog-ng main configuration file (1.5.5a) -" Maintainer: -- -" Last change: 2001 Apr 13 -" URL: -- -" syslog-ng's home: http://www.balabit.hu -" Something like this in filetype.vim would be helpful -" au BufNewFile,BufRead syslog-ng.conf setf syslog-ng - - -" Remove any old syntax stuff hanging around -syn clear -syn case match -set iskeyword=a-z,A-Z,48-57,_,-,. - -syn keyword sysngStatement source destination filter log options -syn match sysngComment "#.*$" -syn match sysngString +"[^"]*"+ -syn match sysngOctNumber "\<0\o\+\>" -syn match sysngDecNumber "\<\d\+\>" -syn match sysngHexNumber "\<0x\x\+\>" -syn keyword sysngBool yes no on off -syn match sysngIdentifier "\<[sdf]_\+\>" - -syn keyword sysngDriver internal remote_control -syn keyword sysngDriver file fifo pipe door -syn keyword sysngDriver udp tcp udp6 tcp6 -syn keyword sysngDriver sun_stream sun_streams sun-stream sun-streams -syn keyword sysngDriver unix_dgram unix_stream unix-dgram unix-stream -syn keyword sysngDriver usertty program - -syn keyword sysngFilter not and or .. level priority facility -syn keyword sysngFilter program host match DEFAULT - -if !exists("did_sysng_syntax_inits") - let did_sysng_syntax_inits = 1 - - hi link sysngStatement Statement - hi link sysngComment Comment - hi link sysngString String - hi link sysngOctNumber Number - hi link sysngDecNumber Number - hi link sysngHexNumber Number - hi link sysngBool Constant - hi link sysngIdentifier Identifier - - hi link sysngDriver Type - hi link sysngFilter Operator -endif - -let b:current_syntax = "syslog-ng" -