[syslog-ng]pipes and tags

Balazs Scheidler syslog-ng@lists.balabit.hu
Fri, 28 Nov 2003 14:59:24 +0100


On Fri, Nov 28, 2003 at 12:22:05PM +0100, Bedo Sandor wrote:
> 
> 
>   Hi,
> 
> Syslog-ng sends to the program destination
> "<num>blah-blah" formatted lines, where num is a
> decimal-coded value of the priority and facility.  I
> have a little application that strongly uses this
> number.  There's a master syslog-ng in my system, and
> there is a chroot-ed syslog-ng with this little
> application.  The two syslog-ngs communicates each
> other using named pipes found in the chroot-ed
> environment, but the decimal value does not come across
> the pipes, and I can only put a hexadecimal value with
> template("<$PRI>$MSG\n") back.
> 
> Why doesn't use pipe() the same template like file()?
> 
> Is it able to send this value in decimal format on the
> pipe?

please try this patch

Index: macros.c
===================================================================
RCS file: /var/cvs/syslog-ng/syslog-ng/src/macros.c,v
retrieving revision 1.4
diff -u -r1.4 macros.c
--- macros.c    16 Apr 2003 10:15:02 -0000      1.4
+++ macros.c    28 Nov 2003 13:58:45 -0000
@@ -139,6 +139,10 @@
                length = snprintf(*dest, *left, "%02x", msg->pri);
                break;
        }
+       case M_PRI: {
+               length = snprintf(*dest, *left, "%d", msg->pri);
+               break;
+       }
        case M_SOURCE_IP: {
                char *ip;
   
@@ -376,6 +380,7 @@
        { "PRIORITY", M_LEVEL },
        { "LEVEL", M_LEVEL },
        { "TAG", M_TAG },
+       { "PRI", M_PRI },
  
        { "DATE", M_DATE },
        { "FULLDATE", M_FULLDATE },
Index: macros.h
===================================================================
RCS file: /var/cvs/syslog-ng/syslog-ng/src/macros.h,v
retrieving revision 1.2
diff -u -r1.2 macros.h
--- macros.h    10 Apr 2003 10:51:00 -0000      1.2
+++ macros.h    28 Nov 2003 13:58:45 -0000
@@ -28,6 +28,7 @@
 #define M_FACILITY 0
 #define M_LEVEL    1
 #define M_TAG      2
+#define M_PRI      50
  
 #define M_DATE     3
 #define M_FULLDATE 4


-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1