[syslog-ng] [PATCH (3.4) 2/5] Add an "indented-multiline" logreader flag

Gergely Nagy algernon at balabit.hu
Sat Oct 13 17:20:18 CEST 2012


Teach logreader to accept "indented-multiline" as a flag, so that
affile and afsocket can look for it, and set the proto to
indented-multiline instead of text if the flag's found.

Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 lib/logreader.c           |    1 +
 lib/logreader.h           |    1 +
 modules/affile/affile.c   |    3 +++
 modules/afsocket/afinet.c |    5 ++++-
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/logreader.c b/lib/logreader.c
index eb52330..e96e825 100644
--- a/lib/logreader.c
+++ b/lib/logreader.c
@@ -906,6 +906,7 @@ CfgFlagHandler log_reader_flag_handlers[] =
   { "kernel",                     CFH_SET, offsetof(LogReaderOptions, flags),               LR_KERNEL },
   { "empty-lines",                CFH_SET, offsetof(LogReaderOptions, flags),               LR_EMPTY_LINES },
   { "threaded",                   CFH_SET, offsetof(LogReaderOptions, flags),               LR_THREADED },
+  { "indented-multiline",         CFH_SET, offsetof(LogReaderOptions, flags),               LR_INDENTED_ML },
   { NULL },
 };
 
diff --git a/lib/logreader.h b/lib/logreader.h
index 5acb03b..df24c74 100644
--- a/lib/logreader.h
+++ b/lib/logreader.h
@@ -36,6 +36,7 @@
 #define LR_SYSLOG_PROTOCOL 0x0010
 #define LR_PREEMPT         0x0020
 #define LR_THREADED        0x0040
+#define LR_INDENTED_ML     0x0080
 
 /* options */
 
diff --git a/modules/affile/affile.c b/modules/affile/affile.c
index 17be55c..d756070 100644
--- a/modules/affile/affile.c
+++ b/modules/affile/affile.c
@@ -30,6 +30,7 @@
 #include "mainloop.h"
 #include "logproto-record-server.h"
 #include "logproto-text-server.h"
+#include "logproto-indented-multiline-server.h"
 #include "logproto-text-client.h"
 #include "logproto-linux-proc-kmsg-reader.h"
 #include "logproto-file-writer.h"
@@ -210,6 +211,8 @@ affile_sd_construct_proto(AFFileSourceDriver *self, gint fd)
     return log_proto_padded_record_server_new(transport, proto_options, self->pad_size);
   else if (affile_is_linux_proc_kmsg(self->filename->str))
     return log_proto_linux_proc_kmsg_reader_new(transport, proto_options);
+  else if (self->reader_options.flags & LR_INDENTED_ML)
+    return log_proto_indented_multiline_server_new(transport, proto_options);
   else
     return log_proto_text_server_new(transport, proto_options);
 }
diff --git a/modules/afsocket/afinet.c b/modules/afsocket/afinet.c
index 542f3f4..abf9020 100644
--- a/modules/afsocket/afinet.c
+++ b/modules/afsocket/afinet.c
@@ -299,7 +299,10 @@ afinet_sd_apply_transport(AFSocketSourceDriver *s)
       else
         {
           default_bind_port = "514";
-          self->super.logproto_name = "text";
+          if (self->super.reader_options.flags & LR_INDENTED_ML)
+            self->super.logproto_name = "indented-multiline";
+          else
+            self->super.logproto_name = "text";
         }
       self->super.sock_type = SOCK_STREAM;
     }
-- 
1.7.10.4




More information about the syslog-ng mailing list