--- /dev/null
+diff -ur syslog-ng-3.2.4.org/lib/gprocess.c syslog-ng-3.2.4/lib/gprocess.c
+--- syslog-ng-3.2.4.org/lib/gprocess.c 2011-09-10 19:11:42.848926449 +0200
++++ syslog-ng-3.2.4/lib/gprocess.c 2011-09-10 19:21:08.665586449 +0200
+@@ -305,10 +305,23 @@
+ return;
+ }
+
++#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
++
++static int
++get_kernel_version(void) {
++ static struct utsname uts;
++ int x = 0, y = 0, z = 0;
++ if ((uname(&uts) == -1) || (sscanf(uts.release, "%u.%u.%u", &x, &y, &z) < 2)) {
++ msg_error("Unable to retrieve kernel version.", NULL);
++ return -1;
++ }
++ return LINUX_VERSION(x, y, z);
++}
++
+ gboolean
+ g_process_check_cap_syslog(void)
+ {
+- int ret;
++ int ret, kver;
+
+ if (have_capsyslog)
+ return TRUE;
+@@ -320,6 +333,10 @@
+ if (ret == -1)
+ return FALSE;
+
++ kver = get_kernel_version();
++ if (kver > 0 && kver < LINUX_VERSION(2,6,38))
++ return FALSE;
++
+ have_capsyslog = TRUE;
+ return TRUE;
+ }
+diff -ur syslog-ng-3.2.4.org/lib/gprocess.h syslog-ng-3.2.4/lib/gprocess.h
+--- syslog-ng-3.2.4.org/lib/gprocess.h 2011-09-10 19:11:42.848926449 +0200
++++ syslog-ng-3.2.4/lib/gprocess.h 2011-09-10 19:15:44.334619870 +0200
+@@ -28,6 +28,7 @@
+ #include "syslog-ng.h"
+
+ #include <sys/types.h>
++#include <sys/utsname.h>
+
+ #if ENABLE_LINUX_CAPS
+ # include <sys/capability.h>
--- /dev/null
+
+https://lists.balabit.hu/pipermail/syslog-ng/2009-August/013325.html
+
+
+ [syslog-ng] PATCH: Log file size limit (was: Logfile Rotation)
+
+Balazs Scheidler wrote:
+>>
+>> Personally I prefer to arrange log rotation based on the file size
+>> rather than some fixed time interval, so I have added that feature
+>> to syslog-ng. If anyone is interested I can explain in more details
+>> and post the patch.
+>
+> Please do. That's what open source is about.
+>
+
+The following patch introduces two new configuration options:
+'file_size_limit' to be used inside global 'options' and 'size_limit' to
+be used inside 'file' destination. Each option specifies log file size
+limit in bytes. If the global option is set to a value greater than zero
+it applies to all 'file' destinations. A particular file destination can
+remove the limit by setting it to zero. For example:
+
+# set the global file size limit
+options { file_size_limit(123456); };
+
+# set a different size limit for a particular file destination
+destination log1 { file("/var/log/log1.log" size_limit(456789)); };
+
+# remove size limit for a particular file destination
+# (only useful if there is a global size limit set)
+destination log2 { file("/var/log/log2.log" size_limit(0)); };
+
+The file size is checked after writing each log message and if the file
+has grown up to or above the size limit the file is renamed and a new
+empty file is created to continue logging to. The name format the
+"overgrown" log file is renamed to is "<p>-<s>.<m>-<r>", where <p> - the
+full path and name of the original log file, <s> - current time in UNIX
+format (seconds since Jan 1, 1970), <m> - fractional part of the current
+time (microseconds, 6 digits), <r> - a random number (10 digits).
+
+The intended use is to have incrond or another similar mechanism to
+detect when there is a new "renamed" log file and to process it in
+whatever way necessary (gzip it, parse it, send it my email, etc.).
+
+*********** BEGIN PATCH ***********
+diff -U5 -rb syslog-ng-3.0.4-orig/src/affile.c syslog-ng-3.0.4/src/affile.c
+--- syslog-ng-3.0.4-orig/src/affile.c 2009-07-31 11:41:20.000000000 +0200
++++ syslog-ng-3.0.4/src/affile.c 2009-08-17 11:02:41.000000000 +0200
+@@ -428,14 +428,72 @@
+ {
+ return log_queue_get_length(((LogWriter *) self->writer)->queue) == 0;
+ }
+
+ static gboolean
++affile_dw_open_file(AFFileDestWriter *self, int *fd)
++{
++ return affile_open_file(self->filename->str, (self->owner->flags & AFFILE_PIPE)?
++ (O_RDWR | O_NOCTTY | O_NONBLOCK | O_LARGEFILE):
++ (O_WRONLY | O_CREAT | O_NOCTTY | O_NONBLOCK | O_LARGEFILE),
++ self->owner->file_uid, self->owner->file_gid, self->owner->file_perm,
++ self->owner->dir_uid, self->owner->dir_gid, self->owner->dir_perm,
++ !!(self->owner->flags & AFFILE_CREATE_DIRS), FALSE, !!(self->owner->flags & AFFILE_PIPE), fd);
++}
++
++static void
++affile_dw_transport_callback(gint fd, void *context)
++{
++ static const size_t extra_length = 32;
++ AFFileDestWriter *self = (AFFileDestWriter *) context;
++ off_t size = lseek(fd, 0, SEEK_CUR);
++ GTimeVal time;
++ GString *name;
++ int reopen_fd;
++ if ((size > 0) && (size >= self->owner->size_limit))
++ {
++ /* TODO: use g_file_read_link() */
++ g_get_current_time(&time);
++ name = g_string_sized_new(self->filename->len + extra_length);
++ g_string_printf(name, "%s-%lu.%06lu-%010lu", self->filename->str, (gulong)time.tv_sec, (gulong)time.tv_usec, (gulong)g_random_int());
++ if (rename(self->filename->str, name->str) == 0)
++ {
++ if (affile_dw_open_file(self, &reopen_fd))
++ {
++ if (dup2(reopen_fd, fd) < 0)
++ {
++ msg_error("Error swithing to new log file",
++ evt_tag_str("filename", self->filename->str),
++ evt_tag_errno(EVT_TAG_OSERROR, errno),
++ NULL);
++ }
++ close(reopen_fd);
++ }
++ else
++ {
++ msg_error("Error opening file for writing",
++ evt_tag_str("filename", self->filename->str),
++ evt_tag_errno(EVT_TAG_OSERROR, errno),
++ NULL);
++ }
++ }
++ else
++ {
++ msg_error("Error renaming overgrown file",
++ evt_tag_str("filename", self->filename->str),
++ evt_tag_errno(EVT_TAG_OSERROR, errno),
++ NULL);
++ }
++ g_string_free(name, TRUE);
++ }
++}
++
++static gboolean
+ affile_dw_init(LogPipe *s)
+ {
+ AFFileDestWriter *self = (AFFileDestWriter *) s;
+- int fd, flags;
++ int fd;
+ struct stat st;
+ GlobalConfig *cfg = log_pipe_get_config(s);
+
+ if (cfg)
+ self->time_reopen = cfg->time_reopen;
+@@ -454,20 +512,12 @@
+ evt_tag_int("overwrite_if_older", self->owner->overwrite_if_older),
+ NULL);
+ unlink(self->filename->str);
+ }
+
+- if (self->owner->flags & AFFILE_PIPE)
+- flags = O_RDWR | O_NOCTTY | O_NONBLOCK | O_LARGEFILE;
+- else
+- flags = O_WRONLY | O_CREAT | O_NOCTTY | O_NONBLOCK | O_LARGEFILE;
+-
+ self->last_open_stamp = time(NULL);
+- if (affile_open_file(self->filename->str, flags,
+- self->owner->file_uid, self->owner->file_gid, self->owner->file_perm,
+- self->owner->dir_uid, self->owner->dir_gid, self->owner->dir_perm,
+- !!(self->owner->flags & AFFILE_CREATE_DIRS), FALSE, !!(self->owner->flags & AFFILE_PIPE), &fd))
++ if (affile_dw_open_file(self, &fd))
+ {
+ guint write_flags;
+
+ if (!self->writer)
+ {
+@@ -482,11 +532,11 @@
+ self->writer = NULL;
+ close(fd);
+ return FALSE;
+ }
+ write_flags = ((self->owner->flags & AFFILE_FSYNC) ? LTF_FSYNC : 0) | LTF_APPEND;
+- log_writer_reopen(self->writer, log_proto_plain_new_client(log_transport_plain_new(fd, write_flags)));
++ log_writer_reopen(self->writer, log_proto_plain_new_client(((self->owner->size_limit > 0) && !(self->owner->flags & AFFILE_PIPE))? log_transport_plain_new_with_callback(fd, write_flags, affile_dw_transport_callback, self): log_transport_plain_new(fd, write_flags)));
+ }
+ else
+ {
+ msg_error("Error opening file for writing",
+ evt_tag_str("filename", self->filename->str),
+@@ -678,10 +728,18 @@
+ AFFileDestDriver *self = (AFFileDestDriver *) s;
+
+ self->local_time_zone = g_strdup(local_time_zone);
+ }
+
++void
++affile_dd_set_file_size_limit(LogDriver *s, off_t file_size_limit)
++{
++ AFFileDestDriver *self = (AFFileDestDriver *) s;
++
++ self->size_limit = file_size_limit;
++}
++
+ static inline gchar *
+ affile_dd_format_persist_name(AFFileDestDriver *self)
+ {
+ static gchar persist_name[1024];
+
+@@ -766,10 +824,12 @@
+ self->dir_gid = cfg->dir_gid;
+ if (self->dir_perm == (mode_t) -1)
+ self->dir_perm = cfg->dir_perm;
+ if (self->time_reap == -1)
+ self->time_reap = cfg->time_reap;
++ if (self->size_limit == -1)
++ self->size_limit = cfg->file_size_limit;
+
+ self->use_time_recvd = cfg->use_time_recvd;
+
+ if (self->local_time_zone_info)
+ time_zone_info_free(self->local_time_zone_info);
+@@ -973,7 +1033,8 @@
+ if (strchr(filename, '$') == NULL)
+ {
+ self->flags |= AFFILE_NO_EXPAND;
+ }
+ self->time_reap = -1;
++ self->size_limit = -1;
+ return &self->super;
+ }
+diff -U5 -rb syslog-ng-3.0.4-orig/src/affile.h syslog-ng-3.0.4/src/affile.h
+--- syslog-ng-3.0.4-orig/src/affile.h 2009-04-30 12:22:53.000000000 +0200
++++ syslog-ng-3.0.4/src/affile.h 2009-08-17 10:10:39.000000000 +0200
+@@ -72,10 +72,11 @@
+
+ gint overwrite_if_older;
+ gboolean use_time_recvd;
+ gint time_reap;
+ guint reap_timer;
++ off_t size_limit;
+ } AFFileDestDriver;
+
+ LogDriver *affile_dd_new(gchar *filename, guint32 flags);
+
+ void affile_dd_set_compress(LogDriver *s, gboolean compress);
+@@ -88,7 +89,8 @@
+ void affile_dd_set_dir_perm(LogDriver *s, mode_t dir_perm);
+ void affile_dd_set_create_dirs(LogDriver *s, gboolean create_dirs);
+ void affile_dd_set_fsync(LogDriver *s, gboolean enable);
+ void affile_dd_set_overwrite_if_older(LogDriver *s, gint overwrite_if_older);
+ void affile_dd_set_local_time_zone(LogDriver *s, const gchar *local_time_zone);
++void affile_dd_set_file_size_limit(LogDriver *s, off_t file_size_limit);
+
+ #endif
+diff -U5 -rb syslog-ng-3.0.4-orig/src/cfg-grammar.y syslog-ng-3.0.4/src/cfg-grammar.y
+--- syslog-ng-3.0.4-orig/src/cfg-grammar.y 2009-08-05 12:34:18.000000000 +0200
++++ syslog-ng-3.0.4/src/cfg-grammar.y 2009-08-17 10:10:39.000000000 +0200
+@@ -154,10 +154,11 @@
+ %token KW_DIR_OWNER KW_DIR_GROUP KW_DIR_PERM
+ %token KW_TEMPLATE KW_TEMPLATE_ESCAPE
+ %token KW_FOLLOW_FREQ
+ %token KW_OVERWRITE_IF_OLDER
+ %token KW_DEFAULT_FACILITY KW_DEFAULT_LEVEL
++%token KW_FILE_SIZE_LIMIT KW_SIZE_LIMIT
+
+ /* socket related options */
+ %token KW_KEEP_ALIVE KW_MAX_CONNECTIONS
+ %token KW_LOCALIP KW_IP KW_LOCALPORT KW_PORT KW_DESTPORT
+ %token KW_IP_TTL KW_SO_BROADCAST KW_IP_TOS KW_SO_SNDBUF KW_SO_RCVBUF KW_SO_KEEPALIVE KW_SPOOF_SOURCE
+@@ -799,10 +800,11 @@
+ | KW_DIR_PERM '(' LL_NUMBER ')' { affile_dd_set_dir_perm(last_driver, $3); }
+ | KW_CREATE_DIRS '(' yesno ')' { affile_dd_set_create_dirs(last_driver, $3); }
+ | KW_OVERWRITE_IF_OLDER '(' LL_NUMBER ')' { affile_dd_set_overwrite_if_older(last_driver, $3); }
+ | KW_FSYNC '(' yesno ')' { affile_dd_set_fsync(last_driver, $3); }
+ | KW_LOCAL_TIME_ZONE '(' string ')' { affile_dd_set_local_time_zone(last_driver, $3); free($3); }
++ | KW_SIZE_LIMIT '(' LL_NUMBER ')' { affile_dd_set_file_size_limit(last_driver, $3); }
+ ;
+
+ dest_afpipe
+ : KW_PIPE '(' dest_afpipe_params ')' { $$ = $3; }
+ ;
+@@ -1141,10 +1143,11 @@
+ | KW_FILE_TEMPLATE '(' string ')' { configuration->file_template_name = g_strdup($3); free($3); }
+ | KW_PROTO_TEMPLATE '(' string ')' { configuration->proto_template_name = g_strdup($3); free($3); }
+ | KW_RECV_TIME_ZONE '(' string ')' { configuration->recv_time_zone = g_strdup($3); free($3); }
+ | KW_SEND_TIME_ZONE '(' string ')' { configuration->send_time_zone = g_strdup($3); free($3); }
+ | KW_LOCAL_TIME_ZONE '(' string ')' { configuration->local_time_zone = g_strdup($3); free($3); }
++ | KW_FILE_SIZE_LIMIT '(' LL_NUMBER ')' { configuration->file_size_limit = $3; }
+ ;
+
+ /* BEGIN MARK: tls */
+ tls_options
+ : tls_option tls_options
+diff -U5 -rb syslog-ng-3.0.4-orig/src/cfg-lex.l syslog-ng-3.0.4/src/cfg-lex.l
+--- syslog-ng-3.0.4-orig/src/cfg-lex.l 2009-05-06 11:20:22.000000000 +0200
++++ syslog-ng-3.0.4/src/cfg-lex.l 2009-08-17 10:10:39.000000000 +0200
+@@ -126,10 +126,12 @@
+ { "recv_time_zone", KW_RECV_TIME_ZONE },
+ { "send_time_zone", KW_SEND_TIME_ZONE },
+ { "local_time_zone", KW_LOCAL_TIME_ZONE },
+ { "use_time_recvd", KW_USE_TIME_RECVD, KWS_OBSOLETE, "Use R_ or S_ prefixed macros in templates" },
+ { "use_fqdn", KW_USE_FQDN },
++ { "size_limit", KW_SIZE_LIMIT },
++ { "file_size_limit", KW_FILE_SIZE_LIMIT },
+ { "use_dns", KW_USE_DNS },
+ { "gc_threshold", KW_GC_BUSY_THRESHOLD },
+ { "gc_busy_threshold", KW_GC_BUSY_THRESHOLD },
+ { "gc_idle_threshold", KW_GC_IDLE_THRESHOLD },
+ { "time_reopen", KW_TIME_REOPEN },
+diff -U5 -rb syslog-ng-3.0.4-orig/src/cfg.c syslog-ng-3.0.4/src/cfg.c
+--- syslog-ng-3.0.4-orig/src/cfg.c 2009-04-30 12:00:54.000000000 +0200
++++ syslog-ng-3.0.4/src/cfg.c 2009-08-17 10:10:39.000000000 +0200
+@@ -298,10 +298,11 @@
+
+ self->follow_freq = -1;
+ self->file_uid = 0;
+ self->file_gid = 0;
+ self->file_perm = 0600;
++ self->file_size_limit = 0;
+ self->dir_uid = 0;
+ self->dir_gid = 0;
+ self->dir_perm = 0700;
+
+ self->use_dns_cache = 1;
+diff -U5 -rb syslog-ng-3.0.4-orig/src/cfg.h syslog-ng-3.0.4/src/cfg.h
+--- syslog-ng-3.0.4-orig/src/cfg.h 2009-06-03 13:08:27.000000000 +0200
++++ syslog-ng-3.0.4/src/cfg.h 2009-08-17 10:10:39.000000000 +0200
+@@ -78,10 +78,11 @@
+ gint follow_freq;
+ gboolean create_dirs;
+ uid_t file_uid;
+ gid_t file_gid;
+ mode_t file_perm;
++ off_t file_size_limit;
+
+ uid_t dir_uid;
+ gid_t dir_gid;
+ mode_t dir_perm;
+
+diff -U5 -rb syslog-ng-3.0.4-orig/src/logtransport.c syslog-ng-3.0.4/src/logtransport.c
+--- syslog-ng-3.0.4-orig/src/logtransport.c 2009-04-30 10:53:22.000000000 +0200
++++ syslog-ng-3.0.4/src/logtransport.c 2009-08-17 11:01:33.000000000 +0200
+@@ -53,10 +53,12 @@
+ typedef struct _LogTransportPlain LogTransportPlain;
+
+ struct _LogTransportPlain
+ {
+ LogTransport super;
++ LogTransportCallback callback;
++ void *context;
+ };
+
+ static gssize
+ log_transport_plain_read_method(LogTransport *s, gpointer buf, gsize buflen, GSockAddr **sa)
+ {
+@@ -138,24 +140,32 @@
+ alarm_cancel();
+ if (self->super.flags & LTF_FSYNC)
+ fsync(self->super.fd);
+ }
+ while (rc == -1 && errno == EINTR);
++ if ((self->callback != NULL) && (rc > 0))
++ self->callback(self->super.fd, self->context);
+ return rc;
+ }
+
+
+ LogTransport *
+-log_transport_plain_new(gint fd, guint flags)
++log_transport_plain_new_with_callback(gint fd, guint flags, LogTransportCallback callback, void *context)
+ {
+ LogTransportPlain *self = g_new0(LogTransportPlain, 1);
+
+ self->super.fd = fd;
+ self->super.cond = 0;
+ self->super.flags = flags;
+ self->super.read = log_transport_plain_read_method;
+ self->super.write = log_transport_plain_write_method;
+ self->super.free_fn = log_transport_free_method;
++ self->callback = callback;
++ self->context = context;
+ return &self->super;
+ }
+
+-
++LogTransport *
++log_transport_plain_new(gint fd, guint flags)
++{
++ return log_transport_plain_new_with_callback(fd, flags, NULL, NULL);
++}
+diff -U5 -rb syslog-ng-3.0.4-orig/src/logtransport.h syslog-ng-3.0.4/src/logtransport.h
+--- syslog-ng-3.0.4-orig/src/logtransport.h 2009-04-30 10:46:55.000000000 +0200
++++ syslog-ng-3.0.4/src/logtransport.h 2009-08-17 11:00:58.000000000 +0200
+@@ -57,10 +57,12 @@
+ log_transport_read(LogTransport *self, gpointer buf, gsize count, GSockAddr **sa)
+ {
+ return self->read(self, buf, count, sa);
+ }
+
++typedef void (*LogTransportCallback)(gint fd, void *context);
++LogTransport *log_transport_plain_new_with_callback(gint fd, guint flags, LogTransportCallback callback, void *context);
+ LogTransport *log_transport_plain_new(gint fd, guint flags);
+ void log_transport_free(LogTransport *s);
+ void log_transport_free_method(LogTransport *s);
+
+
+
--- /dev/null
+--- syslog-ng-3.4.3/doc/man.bak/loggen.1.xml 2013-08-13 12:24:20.000000000 +0300
++++ syslog-ng-3.4.3/doc/man/loggen.1.xml 2013-09-30 21:42:33.729604012 +0300
+@@ -264,7 +264,7 @@
+ <refsect1>
+ <title>Files</title>
+ <para>
+- <filename moreinfo="none">/opt/syslog-ng/bin/loggen</filename>
++ <filename moreinfo="none">/usr/bin/loggen</filename>
+ </para>
+ </refsect1>
+ <refsect1>
+--- syslog-ng-3.4.3/doc/man.bak/pdbtool.1.xml 2013-08-13 12:24:20.000000000 +0300
++++ syslog-ng-3.4.3/doc/man/pdbtool.1.xml 2013-09-30 21:42:33.729604012 +0300
+@@ -302,10 +302,10 @@
+ <refsect1>
+ <title>Files</title>
+ <para>
+- <filename moreinfo="none">/opt/syslog-ng/bin/pdbtool</filename>
++ <filename moreinfo="none">/usr/bin/pdbtool</filename>
+ </para>
+ <para>
+- <filename moreinfo="none">/opt/syslog-ng/etc/syslog-ng/syslog-ng.conf</filename>
++ <filename moreinfo="none">/etc/syslog-ng/syslog-ng.conf</filename>
+ </para>
+ </refsect1>
+ <refsect1>
+--- syslog-ng-3.4.3/doc/man.bak/syslog-ng-ctl.1.xml 2013-08-13 12:24:20.000000000 +0300
++++ syslog-ng-3.4.3/doc/man/syslog-ng-ctl.1.xml 2013-09-30 21:42:33.729604012 +0300
+@@ -120,7 +120,7 @@
+ <refsect1>
+ <title>Files</title>
+ <para>
+- <filename moreinfo="none">/opt/syslog-ng/sbin/syslog-ng-ctl</filename>
++ <filename moreinfo="none">/sbin/syslog-ng-ctl</filename>
+ </para>
+ </refsect1>
+ <refsect1>
+--- syslog-ng-3.4.3/doc/man.bak/syslog-ng.8.xml 2013-08-13 12:24:20.000000000 +0300
++++ syslog-ng-3.4.3/doc/man/syslog-ng.8.xml 2013-09-30 21:42:33.729604012 +0300
+@@ -236,10 +236,10 @@
+ <refsect1>
+ <title>Files</title>
+ <para>
+- <filename moreinfo="none">/opt/syslog-ng/</filename>
++ <filename moreinfo="none">/usr/share/syslog-ng</filename>
+ </para>
+ <para>
+- <filename moreinfo="none">/opt/syslog-ng/etc/syslog-ng.conf</filename>
++ <filename moreinfo="none">/etc/syslog-ng.conf</filename>
+ </para>
+ </refsect1>
+ <refsect1>
+--- syslog-ng-3.4.3/doc/man.bak/syslog-ng.conf.5.xml 2013-08-13 12:24:20.000000000 +0300
++++ syslog-ng-3.4.3/doc/man/syslog-ng.conf.5.xml 2013-09-30 21:42:33.729604012 +0300
+@@ -408,10 +408,10 @@
+ <refsect1>
+ <title>Files</title>
+ <para>
+- <filename moreinfo="none">/opt/syslog-ng/</filename>
++ <filename moreinfo="none">/usr/share/syslog-ng/</filename>
+ </para>
+ <para>
+- <filename moreinfo="none">/opt/syslog-ng/etc/syslog-ng.conf</filename>
++ <filename moreinfo="none">/etc/syslog-ng/syslog-ng.conf</filename>
+ </para>
+ </refsect1>
+ <refsect1>
--- /dev/null
+--- syslog-ng-3.2.2/lib/syslog-ng.h~ 2011-01-04 12:57:06.000000000 +0100
++++ syslog-ng-3.2.2/lib/syslog-ng.h 2011-01-17 19:31:46.933293237 +0100
+@@ -47,10 +47,10 @@
+ #define PATH_SYSLOGNG PATH_LIBEXECDIR "/syslog-ng"
+ #endif
+
+-#define PATH_PERSIST_CONFIG PATH_LOCALSTATEDIR "/syslog-ng.persist"
+-#define PATH_QDISK PATH_LOCALSTATEDIR
+-#define PATH_PATTERNDB_FILE PATH_LOCALSTATEDIR "/patterndb.xml"
+-#define PATH_XSDDIR PATH_DATADIR "/xsd"
++#define PATH_PERSIST_CONFIG "/var/lib/syslog-ng/syslog-ng.persist"
++#define PATH_QDISK "/var/lib/syslog-ng"
++#define PATH_PATTERNDB_FILE "/var/lib/syslog-ng/patterndb.xml"
++#define PATH_XSDDIR "/var/lib/syslog-ng/xsd"
+
+ #define LOG_PRIORITY_LISTEN 0
+ #define LOG_PRIORITY_READER 0
+--- syslog-ng-3.2.2/scripts/update-patterndb.in~ 2010-11-20 09:47:33.000000000 +0100
++++ syslog-ng-3.2.2/scripts/update-patterndb.in 2011-01-27 20:43:14.656000204 +0100
+@@ -3,6 +3,6 @@
+ exec_prefix=@exec_prefix@
+ bindir=@bindir@
+ sysconfdir=@sysconfdir@
+-localstatedir=@localstatedir@
++localstatedir=/var/lib/syslog-ng
+
+ ${bindir}/pdbtool merge -r --glob *.pdb -D ${sysconfdir}/patterndb.d -p ${localstatedir}/patterndb.xml
--- /dev/null
+--- syslog-ng-3.3.1/configure.in.orig 2011-09-29 08:35:39.000000000 +0200
++++ syslog-ng-3.3.1/configure.in 2011-11-11 10:37:51.371629795 +0100
+@@ -465,11 +465,10 @@
+ dnl ***************************************************************************
+ dnl Checks for libraries
+ AC_CHECK_LIB(door, door_create, BASE_LIBS="$BASE_LIBS -ldoor")
+-AC_CHECK_LIB(socket, socket, BASE_LIBS="$BASE_LIBS -lsocket")
++AC_CHECK_FUNC([socket], [:], [AC_CHECK_LIB(socket, socket, BASE_LIBS="$BASE_LIBS -lsocket")])
+ AC_CHECK_LIB(rt, nanosleep, BASE_LIBS="$BASE_LIBS -lrt")
+-AC_CHECK_LIB(nsl, gethostbyname, BASE_LIBS="$BASE_LIBS -lnsl")
+-AC_CHECK_LIB(regex, regexec, REGEX_LIBS="-lregex")
+-AC_CHECK_LIB(resolv, res_init, RESOLV_LIBS="-lresolv")
++AC_CHECK_FUNC([gethostbyname], [:], [AC_CHECK_LIB(nsl, gethostbyname, BASE_LIBS="$BASE_LIBS -lnsl")])
++AC_CHECK_FUNC([regexec], [:], [AC_CHECK_LIB(regex, regexec, REGEX_LIBS="-lregex")])
+
+
+ if test "x$enable_linux_caps" = "xyes" -o "x$enable_linux_caps" = "xauto"; then
--- /dev/null
+@version: 3.0
+#
+# Syslog-ng configuration for PLD Linux
+#
+# Copyright (c) 1999 anonymous
+# Copyright (c) 1999 Balazs Scheidler
+# $Id$
+#
+# Syslog-ng configuration file
+
+options {
+ long_hostnames(off);
+ flush_lines(0);
+
+ # The default action of syslog-ng 1.6.0 is to log a STATS line
+ # to the file every 10 minutes. That's pretty ugly after a while.
+ # Change it to every 12 hours so you get a nice daily update of
+ # how many messages syslog-ng missed (0).
+ stats_freq(43200);
+};
+
+source s_kernel { file ("/proc/kmsg" program_override("kernel")); };
+source s_src { unix-stream("/dev/log"); internal(); };
+# if using systemd, comment out the line above, and uncomment line below
+#source s_src { unix-dgram("/run/systemd/journal/syslog"); internal(); };
+
+destination d_mail { file("/var/log/maillog"); };
+destination d_messages { file("/var/log/messages"); };
+destination d_kernel { file("/var/log/kernel"); };
+destination d_console_all { file("/dev/tty12"); };
+
+filter f_kern { facility(kern); };
+filter f_mail { facility(mail); };
+
+log { source(s_kernel); destination(d_kernel); };
+log { source(s_src); destination(d_console_all); };
+log { source(s_src); filter(f_mail); destination(d_mail); };
+log { source(s_src); destination(d_messages); flags(fallback); };
--- /dev/null
+--- syslog-ng-3.3.6/contrib/systemd/syslog-ng.service~ 2012-08-15 10:06:08.000000000 +0200
++++ syslog-ng-3.3.6/contrib/systemd/syslog-ng.service 2013-02-03 14:06:49.380549410 +0100
+@@ -3,8 +3,10 @@
+ Documentation=man:syslog-ng(8)
+
+ [Service]
++EnvironmentFile=-/etc/sysconfig/syslog-ng
+ Sockets=syslog.socket
+-ExecStart=/usr/sbin/syslog-ng -F
++ExecStartPre=-/bin/systemctl stop systemd-kmsg-syslogd.service
++ExecStart=/sbin/syslog-ng -F -f /etc/syslog-ng/syslog-ng.conf --worker-threads=1024
+ ExecReload=/bin/kill -HUP $MAINPID
+ StandardOutput=null
+
+
--- /dev/null
+@version: 3.4
+#
+# Syslog-ng configuration for PLD Linux
+#
+# See syslog-ng(8) and syslog-ng.conf(5) for more information.
+#
+
+options {
+ flush_lines(0);
+ owner(root);
+ group(logs);
+ perm(0640);
+ create_dirs(yes);
+ dir_owner(root);
+ dir_group(logs);
+ dir_perm(0750);
+ stats_freq(3600);
+ time_reopen(10);
+ time_reap(360);
+ mark_freq(600);
+ threaded(yes);
+};
+
+source s_sys {
+ file ("/proc/kmsg" program_override("kernel"));
+ unix-stream("/dev/log" max-connections(1000) log_iw_size(100000));
+# if using systemd, comment out the line above, and uncomment line below
+# unix-dgram("/run/systemd/journal/syslog");
+ internal();
+};
+
+# uncomment the line below if you want to setup syslog server
+#source s_net { udp(); };
+
+# if using systemd, an IP address instead of name may be required here
+#destination d_loghost { udp("loghost" port(514)); };
+
+destination d_kern { file("/var/log/kernel"); };
+destination d_messages { file("/var/log/messages"); };
+destination d_authlog { file("/var/log/secure"); };
+destination d_mail { file("/var/log/maillog"); };
+destination d_uucp { file("/var/log/spooler"); };
+destination d_debug { file("/var/log/debug"); };
+destination d_cron { file("/var/log/cron" owner(root) group(crontab) perm(0660)); };
+destination d_syslog { file("/var/log/syslog"); };
+destination d_daemon { file("/var/log/daemon"); };
+destination d_lpr { file("/var/log/lpr"); };
+destination d_user { file("/var/log/user"); };
+destination d_ppp { file("/var/log/ppp"); };
+destination d_ftp { file("/var/log/xferlog"); };
+destination d_audit { file("/var/log/audit"); };
+destination d_postgres { file("/var/log/pgsql"); };
+destination d_freshclam { file("/var/log/freshclam.log"); };
+
+# Log iptables messages to separate file
+destination d_iptables { file("/var/log/iptables"); };
+
+destination d_console { usertty("root"); };
+#destination d_console_all { file("/dev/tty12"); };
+
+destination d_xconsole { pipe("/dev/xconsole"); };
+
+destination d_newscrit { file("/var/log/news/news.crit" owner(news) group(news)); };
+destination d_newserr { file("/var/log/news/news.err" owner(news) group(news)); };
+destination d_newsnotice { file("/var/log/news/news.notice" owner(news) group(news)); };
+
+# Filters for standard syslog(3) facilities
+#filter f_audit { facility(audit); };
+filter f_authpriv { facility(authpriv, auth); };
+filter f_cron { facility(cron); };
+filter f_daemon { facility(daemon); };
+filter f_ftp { facility(ftp); };
+filter f_kern { facility(kern); };
+filter f_lpr { facility(lpr); };
+filter f_mail { facility(mail); };
+filter f_news { facility(news); };
+filter f_syslog { facility(syslog); };
+filter f_user { facility(user); };
+filter f_uucp { facility(uucp); };
+filter f_local0 { facility(local0); };
+filter f_local1 { facility(local1); };
+filter f_local2 { facility(local2); };
+filter f_local3 { facility(local3); };
+filter f_local4 { facility(local4); };
+filter f_local5 { facility(local5); };
+filter f_local6 { facility(local6); };
+filter f_local7 { facility(local7); };
+
+# Filters for standard syslog(3) priorities
+filter p_debug { level(debug); };
+filter p_info { level(info); };
+filter p_notice { level(notice); };
+filter p_warn { level(warn); };
+filter p_err { level(err); };
+filter p_alert { level(alert); };
+filter p_crit { level(crit); };
+filter p_emergency { level(emerg); };
+
+# Additional filters for specific programs/use
+filter f_freshclam { program(freshclam); };
+filter f_ppp { program(pppd) or program(chat); };
+filter f_postgres { program(postgres); };
+filter f_iptables { match("IN=[A-Za-z0-9\.]* OUT=[A-Za-z0-9\.]*" value("MESSAGE")); };
+
+log { source(s_sys); filter(f_authpriv); destination(d_authlog); };
+log { source(s_sys); filter(f_cron); destination(d_cron); };
+log { source(s_sys); filter(f_daemon); destination(d_daemon); };
+log { source(s_sys); filter(f_ftp); destination(d_ftp); };
+log { source(s_sys); filter(f_kern); destination(d_kern); };
+log { source(s_sys); filter(f_lpr); destination(d_lpr); };
+log { source(s_sys); filter(f_mail); destination(d_mail); };
+log { source(s_sys); filter(f_news); filter(p_crit); destination(d_uucp); };
+log { source(s_sys); filter(f_news); filter(p_crit); destination(d_newscrit); };
+log { source(s_sys); filter(f_news); filter(p_err); destination(d_newserr); };
+log { source(s_sys); filter(f_news); filter(p_warn); destination(d_newsnotice); };
+log { source(s_sys); filter(f_news); filter(p_notice); destination(d_newsnotice); };
+log { source(s_sys); filter(f_news); filter(p_info); destination(d_newsnotice); };
+log { source(s_sys); filter(f_news); filter(p_debug); destination(d_newsnotice); };
+log { source(s_sys); filter(f_syslog); destination(d_syslog); };
+log { source(s_sys); filter(f_user); destination(d_user); };
+log { source(s_sys); filter(f_uucp); destination(d_uucp); };
+
+log { source(s_sys); filter(p_debug); destination(d_debug); };
+
+log { source(s_sys); filter(f_daemon); filter(f_ppp); destination(d_ppp); };
+log { source(s_sys); filter(f_local6); filter(f_freshclam); destination(d_freshclam); };
+log { source(s_sys); filter(f_local0); filter(f_postgres); destination(d_postgres); };
+#log { source(s_sys); filter(f_iptables); destination(d_iptables); };
+
+log { source(s_sys); filter(p_emergency); destination(d_console); };
+#log { source(s_sys); destination(d_console_all); };
+
+# This is a catchall statement, and should catch all messages which were not
+# accepted any of the previous statements.
+log { source(s_sys); destination(d_messages); flags(fallback); };
+
+# Network syslogging
+#log { source(s_sys); destination(d_loghost); };
--- /dev/null
+#!/bin/sh
+#
+# syslog Starts syslog-ng (syslogd replacement).
+#
+# chkconfig: 2345 17 83
+# description: Syslog is the facility by which many daemons use to log \
+# messages to various system log files. It is a good idea to \
+# always run syslog.
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get service config
+if [ -f /etc/sysconfig/syslog-ng ]; then
+ . /etc/sysconfig/syslog-ng
+fi
+
+# configtest itself
+# must return non-zero if check failed
+# output is discarded if checkconfig is ran without details
+configtest() {
+ syslog-ng $OPTIONS -F -s -p /var/run/syslog-ng-syntaxcheck.pid
+ return $?
+}
+
+# wrapper for configtest
+checkconfig() {
+ local details=${1:-0}
+
+ if [ $details = 1 ]; then
+ # run config test and display report (status action)
+ show "Checking %s configuration" "syslog-ng"; busy
+ local out
+ out=$(configtest 2>&1)
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ ok
+ else
+ fail
+ fi
+ [ "$out" ] && echo >&2 "$out"
+ else
+ # run config test and abort with nice message if failed
+ # (for actions checking status before action).
+ configtest >/dev/null 2>&1
+ RETVAL=$?
+ if [ $RETVAL != 0 ]; then
+ show "Checking %s configuration" "syslog-ng"; fail
+ nls 'Configuration test failed. See details with %s "checkconfig"' $0
+ exit $RETVAL
+ fi
+ fi
+}
+
+start() {
+ # Check if the service is already running?
+ if [ -f /var/lock/subsys/syslog-ng ]; then
+ msg_already_running "syslog-ng"
+ return
+ fi
+
+ msg_starting "syslog-ng"
+ emit starting JOB=syslog-ng SERVICE_syslog=y
+ daemon @@SBINDIR@@/syslog-ng -f /etc/syslog-ng/syslog-ng.conf --worker-threads=1024 $OPTIONS
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/syslog-ng
+ emit --no-wait started JOB=syslog-ng SERVICE_syslog=y
+}
+
+stop() {
+ if [ ! -f /var/lock/subsys/syslog-ng ]; then
+ msg_not_running "syslog-ng"
+ return
+ fi
+
+ msg_stopping "syslog-ng"
+ emit stopping JOB=syslog-ng SERVICE_syslog=y
+ killproc syslog-ng
+ emit --no-wait stopped JOB=syslog-ng SERVICE_syslog=y
+ rm -f /var/lock/subsys/syslog-ng >/dev/null 2>&1
+}
+
+condrestart() {
+ if [ ! -f /var/lock/subsys/syslog-ng ]; then
+ msg_not_running "syslog-ng"
+ RETVAL=$1
+ return
+ fi
+
+ checkconfig
+ stop
+ start
+}
+
+reload() {
+ if [ ! -f /var/lock/subsys/syslog-ng ]; then
+ msg_not_running "syslog-ng"
+ RETVAL=7
+ return
+ fi
+
+ checkconfig
+ msg_reloading "syslog-ng"
+ killproc syslog-ng -HUP
+ RETVAL=$?
+}
+
+flush_logs() {
+ if use_upstart && [ -f /etc/init/syslog-ng.conf ]; then
+ checkconfig
+ /sbin/initctl reload syslog-ng
+ elif [ -x /bin/systemd_booted ] && /bin/systemd_booted; then
+ checkconfig
+ msg_reloading "syslog-ng"
+ /bin/systemctl reload syslog-ng.service
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && ok || fail
+ elif [ -f /var/lock/subsys/syslog-ng ]; then
+ checkconfig
+ msg_reloading "syslog-ng"
+ killproc syslog-ng -HUP
+ RETVAL=$?
+ else
+ msg_not_running "syslog-ng"
+ RETVAL=7
+ fi
+}
+
+upstart_controlled --except checkconfig configtest flush-logs
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ configtest
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ configtest
+ stop
+ start
+ ;;
+ try-restart)
+ condrestart 0
+ ;;
+ reload|force-reload)
+ reload
+ ;;
+ flush-logs)
+ flush_logs
+ ;;
+ checkconfig|configtest)
+ checkconfig 1
+ ;;
+ status)
+ status syslog-ng
+ exit $?
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status|checkconfig|flush-logs}"
+ exit 3
+esac
+
+exit $RETVAL
--- /dev/null
+/var/log/daemon
+/var/log/debug
+/var/log/iptables
+/var/log/kernel
+/var/log/lpr
+/var/log/maillog
+/var/log/messages
+/var/log/pgsql
+/var/log/secure
+/var/log/spooler
+/var/log/syslog
+/var/log/user
+/var/log/xferlog
+{
+ sharedscripts
+
+ postrotate
+ /sbin/service syslog-ng flush-logs >/dev/null
+ endscript
+}
--- /dev/null
+#
+# TODO:
+# - relies on libs in /usr which is wrong
+# (well, for modules bringing additional functionality it's acceptable IMO --q)
+#
+# Conditional build:
+%bcond_with dynamic # link dynamically with glib, eventlog, pcre (modules are always linked dynamically)
+%if "%{pld_release}" == "ac"
+%bcond_with sql # build with support for logging to SQL DB
+%else
+%bcond_without sql # build without support for logging to SQL DB
+%endif
+%bcond_without tests # do not perform "make check"
+%bcond_without json # build without support for JSON template formatting
+%bcond_without mongodb # build without support for mongodb destination
+%bcond_without smtp # build without support for logging into SMTP
+%bcond_with system_libivykis # use system libivykis
+%bcond_with system_rabbitmq # use system librabbitmq [not supported yet]
+
+%if "%{pld_release}" == "ac"
+%define glib2_ver 1:2.16.0
+%else
+%define glib2_ver 1:2.24.0
+%endif
+Summary: Syslog-ng - new generation of the system logger
+Summary(pl.UTF-8): Syslog-ng - systemowy demon logujący nowej generacji
+Summary(pt_BR.UTF-8): Daemon de log nova geração
+Name: syslog-ng
+Version: 3.4.3
+Release: 1
+License: GPL v2+ with OpenSSL exception
+Group: Daemons
+Source0: http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/%{version}/source/%{name}_%{version}.tar.gz
+# Source0-md5: 80b873a11b3e02706bc3f2430b9be068
+Source1: %{name}.init
+Source2: %{name}.conf
+Source3: %{name}.logrotate
+Source4: http://www.balabit.com/support/documentation/syslog-ng-ose-3.4-guides/en/syslog-ng-ose-v3.4-guide-admin/pdf/%{name}-ose-v3.4-guide-admin.pdf
+# Source4-md5: fbc1516a2af9f40d0a7c4929fdf381b1
+Source5: %{name}-simple.conf
+Source6: %{name}.upstart
+Patch0: %{name}-datadir.patch
+Patch1: cap_syslog-vserver-workaround.patch
+Patch2: %{name}-nolibs.patch
+Patch3: %{name}-systemd.patch
+Patch4: man-paths.patch
+URL: http://www.balabit.com/products/syslog_ng/
+BuildRequires: GeoIP-devel >= 1.5.1
+BuildRequires: autoconf >= 2.53
+BuildRequires: automake
+BuildRequires: bison >= 2.4
+BuildRequires: docbook-style-xsl
+BuildRequires: eventlog-devel >= 0.2.12
+%{?with_tests:BuildRequires: findutils}
+BuildRequires: flex
+BuildRequires: glib2-devel >= %{glib2_ver}
+%{?with_json:BuildRequires: json-c-devel >= 0.7}
+BuildRequires: libcap-devel
+%{?with_sql:BuildRequires: libdbi-devel >= 0.8.3-2}
+%{?with_smtp:BuildRequires: libesmtp-devel}
+%{?with_system_libivykis:BuildRequires: libivykis-devel >= 0.36.1}
+%{?with_mongodb:BuildRequires: libmongo-client-devel >= 0.1.6}
+BuildRequires: libnet-devel >= 1:1.1.2.1-3
+BuildRequires: libtool >= 2:2.0
+BuildRequires: libwrap-devel
+BuildRequires: openssl-devel >= 0.9.8
+BuildRequires: pcre-devel >= 6.1
+BuildRequires: pkgconfig
+%{?with_system_rabbitmq:BuildRequires: rabbitmq-c-devel >= 0.0.1}
+BuildRequires: rpm >= 4.4.9-56
+BuildRequires: rpmbuild(macros) >= 1.623
+BuildRequires: which
+%if %{with tests}
+%{?with_sql:BuildRequires: libdbi-drivers-sqlite3}
+BuildRequires: python
+BuildRequires: python-modules
+BuildRequires: tzdata
+%endif
+%if %{without dynamic}
+BuildRequires: eventlog-static >= 0.2.12
+BuildRequires: glib2-static >= %{glib2_ver}
+%{?with_system_libivykis:BuildRequires: libivykis-static >= 0.36.1}
+BuildRequires: pcre-static >= 6.1
+BuildRequires: zlib-static
+%endif
+Requires(post): fileutils
+Requires(post,preun): /sbin/chkconfig
+Requires(post,preun,postun): systemd-units >= 38
+Requires: %{name}-libs = %{version}-%{release}
+Requires: eventlog >= 0.2.12
+Requires: glib2 >= %{glib2_ver}
+Requires: pcre >= 6.1
+Requires: psmisc >= 20.1
+%{?with_system_rabbitmq:Requires: rabbitmq-c >= 0.0.1}
+Requires: rc-scripts >= 0.4.3.0
+Requires: systemd-units >= 38
+# for afsocket
+Requires: libnet >= 1:1.1.2.1-7
+# for afsocket and dbparser
+Requires: openssl >= 0.9.8
+Provides: service(klogd)
+Provides: service(syslog)
+Provides: syslogdaemon
+Obsoletes: syslog-ng-module-afsocket
+Obsoletes: syslog-ng-module-dbparser
+Obsoletes: syslog-ng-systemd
+Conflicts: klogd
+Conflicts: msyslog
+Conflicts: rsyslog
+Conflicts: syslog
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define xsl_stylesheets_dir /usr/share/sgml/docbook/xsl-stylesheets
+
+# syslog-ng has really crazy linking rules (see their bugzilla).
+# Some rules, according to syslog-ng devs, are like this:
+# - libsyslog-ng.so has undefined symbols for third party libraries
+# and these symbols should go via main syslog-ng binary
+# - same applies for modules
+# In dynamic case tests are forcily linked with dynamic modules, which doesn't work with as-needed.
+%define filterout_ld -Wl,--as-needed -Wl,--no-copy-dt-needed-entries
+
+%if %{without dynamic}
+%define no_install_post_check_so 1
+%define _sbindir /sbin
+%define _libdir /%{_lib}
+%endif
+
+%description
+syslog-ng is a syslogd replacement for Unix and Unix-like systems. It
+has been tested on Solaris, BSDi and Linux, and were found to run
+reliably. syslog-ng gives you a much enhanced configuration scheme,
+which lets you filter messages based on not only priority/facility
+pairs, but also on message content. You can use regexps to direct log
+stream to different destinations. A destination can be anything from a
+simple file to a network connection. syslog-ng supports TCP
+logforwarding, together with hashing to prevent unauthorized
+modification on the line.
+
+%description -l pl.UTF-8
+Syslog-ng jest zamiennikiem dla standardowo używanych programów typu
+syslog. Działa w systemie SunOS, BSD, Linux. Daje znacznie większe
+możliwości logowania i kontrolowania zbieranych informacji.
+
+%description -l pt_BR.UTF-8
+Syslog-ng é um substituto para o syslog tradicional, mas com diversas
+melhorias, como, por exemplo, a habilidade de filtrar mensagens de log
+por seu conteúdo (usando expressões regulares) e não apenas pelo par
+facility/prioridade como o syslog original.
+
+%package upstart
+Summary: Upstart job description for syslog-ng
+Summary(pl.UTF-8): Opis zadania Upstart dla demona syslog-ng
+Group: Daemons
+Requires: %{name} = %{version}-%{release}
+Requires: upstart >= 0.6
+Conflicts: avahi-upstart < 0.6.30-2
+Conflicts: openssh-server-upstart < 2:5.8p2-2
+Conflicts: postgresql-upstart < 9.0.4-2
+
+%description upstart
+Upstart job description for syslog-ng.
+
+%description upstart -l pl.UTF-8
+Opis zadania Upstart dla demona syslog-ng.
+
+%package module-afmongodb
+Summary: MongoDB destination support module for syslog-ng
+Summary(pl.UTF-8): Moduł sysloga-ng do obsługi zapisu logów w bazie MongoDB
+Group: Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: libmongo-client >= 0.1.6
+
+%description module-afmongodb
+MongoDB destination support module for syslog-ng.
+
+%description module-afmongodb -l pl.UTF-8
+Moduł sysloga-ng do obsługi zapisu logów w bazie MongoDB.
+
+%package module-afsmtp
+Summary: SMTP output support module for syslog-ng
+Summary(pl.UTF-8): Moduł sysloga-ng do obsługi wysyłania logów do serwerów SMTP
+Group: Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: openssl >= 0.9.8
+
+%description module-afsmtp
+SMTP output support module for syslog-ng.
+
+%description module-afsmtp -l pl.UTF-8
+Moduł sysloga-ng do obsługi wysyłania logów do serwerów SMTP.
+
+%package module-afsql
+Summary: SQL destination support module for syslog-ng
+Summary(pl.UTF-8): Moduł sysloga-ng do obsługi zapisu logów w bazach SQL
+Group: Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: libdbi >= 0.8.3-2
+Requires: openssl >= 0.9.8
+
+%description module-afsql
+SQL destination support module for syslog-ng (via libdbi).
+
+%description module-afsql -l pl.UTF-8
+Moduł sysloga-ng do obsługi zapisu logów w bazach SQL (poprzez
+libdbi).
+
+%package module-json-plugin
+Summary: JSON formatting template function for syslog-ng
+Summary(pl.UTF-8): Moduł sysloga-ng do obsługi szablonów z formatowaniem JSON
+Group: Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: json-c >= 0.9
+Obsoletes: syslog-ng-module-tfjson
+
+%description module-json-plugin
+JSON formatting template function for syslog-ng.
+
+%description module-json-plugin -l pl.UTF-8
+Moduł sysloga-ng do obsługi szablonów z formatowaniem JSON.
+
+%package module-tfgeoip
+Summary: syslog-ng template function module to get GeoIP info from an IPv4 addresses
+Summary(pl.UTF-8): Moduł funkcji szablonu sysloga-ng do pobierania informacji GeoIP z adresów IPv4
+Group: Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: GeoIP-libs >= 1.5.1
+
+%description module-tfgeoip
+syslog-ng template function module to get GeoIP info from an IPv4
+addresses.
+
+%description module-tfgeoip -l pl.UTF-8
+Moduł funkcji szablonu sysloga-ng do pobierania informacji GeoIP z
+adresów IPv4.
+
+%package libs
+Summary: Shared library for syslog-ng
+Summary(pl.UTF-8): Biblioteka współdzielona sysloga-ng
+Group: Libraries
+%if %{with dynamic}
+Requires: eventlog >= 0.2.12
+Requires: glib2 >= %{glib2_ver}
+%{?with_system_libivykis:Requires: libivykis >= 0.36.1}
+Requires: pcre >= 6.1
+%endif
+Conflicts: syslog-ng < 3.3.1-3
+
+%description libs
+Shared library for syslog-ng.
+
+%description libs -l pl.UTF-8
+Biblioteka współdzielona sysloga-ng.
+
+%package devel
+Summary: Header files for syslog-ng modules development
+Summary(pl.UTF-8): Pliki nagłówkowe do tworzenia modułów dla sysloga-ng
+Group: Development/Libraries
+Requires: %{name}-libs = %{version}-%{release}
+%if %{with dynamic}
+Requires: eventlog-devel >= 0.2.12
+Requires: glib2-devel >= %{glib2_ver}
+%{?with_system_libivykis:Requires: libivykis-devel >= 0.36.1}
+Requires: pcre-devel >= 6.1
+%endif
+
+%description devel
+Header files for syslog-ng modules development.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe do tworzenia modułów dla sysloga-ng.
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+cp -p %{SOURCE4} doc
+cp -p %{SOURCE5} contrib/syslog-ng.conf.simple
+
+%{__sed} -i -e 's|/usr/bin/awk|/bin/awk|' scl/syslogconf/convert-syslogconf.awk
+
+%build
+for i in . lib/ivykis; do
+cd $i
+ %{__libtoolize}
+ %{__aclocal} `[ -d m4 ] && echo '-I m4'`
+ %{__autoconf}
+ %{__autoheader}
+ %{__automake}
+cd -
+done
+%configure \
+ --sysconfdir=%{_sysconfdir}/syslog-ng \
+ --datadir=%{_datadir}/syslog-ng \
+ --disable-silent-rules \
+ --with-default-modules=affile,afprog,afsocket,afuser,basicfuncs,csvparser,dbparser,syslogformat \
+%if %{with mongodb}
+ --enable-mongodb \
+ --with-libmongo-client=system \
+%else
+ --disable-mongodb \
+%endif
+%if %{with system_libivykis}
+ --with-ivykis=system \
+%else
+ --with-ivykis=internal \
+%endif
+ %{?with_system_rabbitmq:--with-librabbitmq-client=system} \
+ --with-module-dir=%{_libdir}/syslog-ng \
+ --with-pidfile-dir=/var/run \
+ --with-timezone-dir=%{_datadir}/zoneinfo \
+ --enable-systemd \
+ --with-systemdsystemunitdir=%{systemdunitdir} \
+ --enable-amqp \
+ --enable-geoip \
+ --enable-ipv6 \
+ --enable-json%{!?with_json:=no} \
+ --enable-linux-caps \
+ --enable-pacct \
+ --enable-pcre \
+ --enable-smtp%{!?with_smtp:=no} \
+ --enable-spoof-source \
+ --enable-ssl \
+ --enable-tcp-wrapper \
+%if %{with sql}
+ --enable-sql \
+%endif
+%if %{with dynamic}
+ --enable-dynamic-linking
+%else
+ --enable-mixed-linking
+%endif
+
+%{__make} \
+ XSL_STYLESHEET=%{xsl_stylesheets_dir}/manpages/docbook.xsl
+
+%if %{with tests}
+LD_LIBRARY_PATH=$(find $PWD -name '*.so*' -printf "%h:")
+PYTHONPATH=$(pwd)/tests/functional
+export LD_LIBRARY_PATH PYTHONPATH
+%{__make} check
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/etc/{sysconfig,logrotate.d,rc.d/init.d,init} \
+ $RPM_BUILD_ROOT%{_sysconfdir}/syslog-ng/patterndb.d \
+ $RPM_BUILD_ROOT/var/{log,lib/%{name}/xsd}
+
+%{__make} -j1 install \
+ pkgconfigdir=%{_pkgconfigdir} \
+ DESTDIR=$RPM_BUILD_ROOT
+
+%{__sed} -e 's|@@SBINDIR@@|%{_sbindir}|g' %{SOURCE1} > $RPM_BUILD_ROOT/etc/rc.d/init.d/syslog-ng
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/syslog-ng/syslog-ng.conf
+cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/syslog-ng
+
+for n in daemon debug iptables kernel lpr maillog messages secure spooler syslog user xferlog; do
+ > $RPM_BUILD_ROOT/var/log/$n
+done
+touch $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/syslog-ng/*.la
+
+%if "%{pld_release}" == "th"
+%{__sed} -e 's|@@SBINDIR@@|%{_sbindir}|g' %{SOURCE6} > $RPM_BUILD_ROOT/etc/init/%{name}.conf
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+if [ "$1" = "1" ]; then
+ # disable /proc/kmsg from config on first install on vserver
+ {
+ while read f ctx; do
+ [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
+ done </proc/self/status
+ } 2>/dev/null
+ if [ -z "$ctx" -o "$ctx" = "0" ]; then
+ VSERVER=no
+ else
+ VSERVER=yes
+ fi
+ if [ "$VSERVER" = "yes" ]; then
+ %{__sed} -i -e '/\/proc\/kmsg/ s/^[^#]/#&/' %{_sysconfdir}/%{name}/%{name}.conf
+ fi
+fi
+
+/sbin/chkconfig --add syslog-ng
+%service syslog-ng restart "syslog-ng daemon"
+
+%systemd_post syslog-ng.service
+
+%preun
+if [ "$1" = "0" ]; then
+ %service syslog-ng stop
+ /sbin/chkconfig --del syslog-ng
+fi
+%systemd_preun syslog-ng.service
+
+%postun
+%systemd_reload
+
+%triggerpostun -- syslog-ng < 3.3.4-3
+%systemd_trigger syslog-ng.service
+
+%triggerun -- syslog-ng < 3.0
+sed -i -e 's#sync(\(.*\))#flush_lines(\1)#g' /etc/syslog-ng/syslog-ng.conf
+sed -i -e 's#pipe ("/proc/kmsg"#file ("/proc/kmsg"#g' /etc/syslog-ng/syslog-ng.conf
+sed -i -e 's#log_prefix#program_override#g' /etc/syslog-ng/syslog-ng.conf
+sed -i -e 's#^destination #destination d_#g' /etc/syslog-ng/syslog-ng.conf
+sed -i -e 's#destination(#destination(d_#g' /etc/syslog-ng/syslog-ng.conf
+sed -i -e 's,\bstats\b,stats_freq,' /etc/syslog-ng/syslog-ng.conf
+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
+sed -i -e "1 s#\(.*\)\$#@version: 3.0\n\1#g" /etc/syslog-ng/syslog-ng.conf
+rm -f %{_var}/lib/%{name}/syslog-ng.persist
+%service -q syslog-ng restart
+exit 0
+
+%post upstart
+%upstart_post %{name}
+
+%postun upstart
+%upstart_postun %{name}
+
+%triggerun upstart -- syslog-ng-upstart < 3.2.4-3
+# use SERVICE_syslog=y in upstart job environment instead of SERVICE=syslog
+%{__sed} -i -e 's,SERVICE=syslog,SERVICE_syslog=y,' /etc/init/*.conf || :
+
+%post libs -p /sbin/ldconfig
+%postun libs -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS NEWS debian/syslog-ng.conf* contrib/relogger.pl
+%doc contrib/syslog-ng.conf.{doc,simple,RedHat}
+%doc contrib/{apparmor,selinux,syslog2ng} doc/syslog-ng-ose-v3.4-guide-admin.pdf
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%attr(750,root,root) %dir %{_sysconfdir}/syslog-ng
+%attr(750,root,root) %dir %{_sysconfdir}/syslog-ng/patterndb.d
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/scl.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/syslog-ng.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/syslog-ng
+%attr(754,root,root) /etc/rc.d/init.d/syslog-ng
+%{systemdunitdir}/syslog-ng.service
+%dir %{_libdir}/syslog-ng
+%attr(755,root,root) %{_libdir}/syslog-ng/libafamqp.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libaffile.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libafprog.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libafsocket.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libafsocket-notls.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libafsocket-tls.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libafuser.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libbasicfuncs.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libconfgen.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libcryptofuncs.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libcsvparser.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libdbparser.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libpacctformat.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libsyslog-ng-crypto.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libsyslogformat.so
+%attr(755,root,root) %{_libdir}/syslog-ng/libsystem-source.so
+%attr(755,root,root) %{_sbindir}/syslog-ng
+%attr(755,root,root) %{_sbindir}/syslog-ng-ctl
+%attr(755,root,root) %{_bindir}/loggen
+%attr(755,root,root) %{_bindir}/pdbtool
+%attr(755,root,root) %{_bindir}/update-patterndb
+
+%dir %{_datadir}/syslog-ng/include
+%dir %{_datadir}/syslog-ng/include/scl
+%dir %{_datadir}/syslog-ng/include/scl/pacct
+%{_datadir}/syslog-ng/include/scl/pacct/plugin.conf
+%dir %{_datadir}/syslog-ng/include/scl/syslogconf
+%{_datadir}/syslog-ng/include/scl/syslogconf/README
+%attr(755,root,root) %{_datadir}/syslog-ng/include/scl/syslogconf/convert-syslogconf.awk
+%{_datadir}/syslog-ng/include/scl/syslogconf/plugin.conf
+%dir %{_datadir}/syslog-ng/include/scl/system
+%{_datadir}/syslog-ng/include/scl/system/plugin.conf
+%dir %{_datadir}/syslog-ng/xsd
+%{_datadir}/syslog-ng/xsd/patterndb-*.xsd
+
+%dir %{_var}/lib/%{name}
+%dir %{_var}/lib/%{name}/xsd
+%{_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*
+
+%attr(640,root,root) %ghost /var/log/daemon
+%attr(640,root,root) %ghost /var/log/debug
+%attr(640,root,root) %ghost /var/log/iptables
+%attr(640,root,root) %ghost /var/log/kernel
+%attr(640,root,root) %ghost /var/log/lpr
+%attr(640,root,root) %ghost /var/log/maillog
+%attr(640,root,root) %ghost /var/log/messages
+%attr(640,root,root) %ghost /var/log/secure
+%attr(640,root,root) %ghost /var/log/spooler
+%attr(640,root,root) %ghost /var/log/syslog
+%attr(640,root,root) %ghost /var/log/user
+%attr(640,root,root) %ghost /var/log/xferlog
+
+%if "%{pld_release}" == "th"
+%files upstart
+%defattr(644,root,root,755)
+%config(noreplace) %verify(not md5 mtime size) /etc/init/%{name}.conf
+%endif
+
+%if %{with mongodb}
+%files module-afmongodb
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/syslog-ng/libafmongodb.so
+%endif
+
+%if %{with smtp}
+%files module-afsmtp
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/syslog-ng/libafsmtp.so
+%endif
+
+%if %{with sql}
+%files module-afsql
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/syslog-ng/libafsql.so
+%endif
+
+%if %{with json}
+%files module-json-plugin
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/syslog-ng/libjson-plugin.so
+%endif
+
+%files module-tfgeoip
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/syslog-ng/libtfgeoip.so
+
+%files libs
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libsyslog-ng-%{version}.so
+%dir %{_datadir}/syslog-ng
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libsyslog-ng.so
+%{_includedir}/syslog-ng
+%{_datadir}/syslog-ng/tools
+%{_pkgconfigdir}/syslog-ng.pc
--- /dev/null
+
+start on pld.sysinit-done
+stop on pld.shutdown-started
+
+env SERVICE_syslog=y
+export SERVICE_syslog
+
+respawn
+
+console output
+
+exec @@SBINDIR@@/syslog-ng --process-mode=background -f /etc/syslog-ng/syslog-ng.conf
+expect fork
+
+# vi: ft=upstart