[syslog-ng] Small problem with pdbtool and the parser ?

Ilas, Yann yann.ilas at eads.com
Thu Jul 29 16:08:00 CEST 2010


Hello,

Thanks ! It works...

Regards,

Yann I.




Hi,

Please use this patch (fix by Viktor Tusa):

diff --git a/src/dbparser/pdbtool.c b/src/dbparser/pdbtool.c
index 5ce3e79..cde859a 100644
--- a/src/dbparser/pdbtool.c
+++ b/src/dbparser/pdbtool.c
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <locale.h>
 
 #if HAVE_GETOPT_H
 #include <getopt.h>
@@ -618,6 +620,7 @@ main(int argc, char *argv[])
       usage();
     }
 
+  setlocale(LC_ALL,"");
   if (!g_option_context_parse(ctx, &argc, &argv, &error))
     {
       fprintf(stderr, "Error parsing command line arguments: %s\n",
error ? error->message : "Invalid arguments");


M

On Wed, 2010-07-28 at 15:39 +0200, Ilas, Yann wrote:
> Hello,
> 
> I have a small problem with pdbtool. When I try to match this message
"> Message message n?2 message 255", I obtain this error : "Error
parsing command line arguments: Invalid byte sequence in conversion
input".
> The problem seems to be the "?" which is bad interpreted by pdbtool.
But the syslog-ng application has not that problem.
> 
> Here is the xml file I used :
> <?xml version='1.0' encoding='UTF-8'?>
> <patterndb version='3' pub_date='2010-07-28'>
>   <ruleset name='test' id='ab-cd-123456789'>
>     <pattern>test</pattern>
>     <rules>
>       <rule provider='yann' id='xxxxx:syslog:abcdef:1234567890:id001'
class='system'>
>       <patterns>
>          <pattern>&gt; Message message n?@NUMBER@ message
@NUMBER@</pattern>
>          <values>
>            <value name=".classifier.facility">local5</value>
>            <value name=".classifier.severity">notice</value>
>            <value name=".classifier.priority">173</value>
>          </values>
>       </patterns>
>       </rule>
>     </rules>
>   </ruleset>
> </patterndb>
> 
> If I use the pattern "<pattern>&gt; Message message n?@NUMBER@ message
@NUMBER@</pattern>", I obtain :
>   $ /opt/syslog-ng/bin/pdbtool match -p patterndb.xml -P test -M '>
Message message n?2 message 255'
>   Error parsing command line arguments: Invalid byte sequence in
conversion input
> => It's not OK
> 
> If I use the pattern "<pattern>&gt; Message message nx at NUMBER@ message
@NUMBER@</pattern>", I obtain :
> (the diffence is the charactere "x" after the " n")
>   $ /opt/syslog-ng/bin/pdbtool match -p patterndb.xml -P test -M '>
Message message nx2 message 255'
>   MESSAGE=> Message message nx2 message 255
>   PROGRAM=test
>   .classifier.class=system
>   .classifier.rule_id=xxxxx:syslog:abcdef:1234567890:id001
>   .classifier.facility=local5
>   .classifier.severity=notice
>   .classifier.priority=173
> => It's OK
> 
> With syslog-ng and the pattern "<pattern>&gt; Message message
n?@NUMBER@ message @NUMBER@</pattern>", I tried to send the same message
(with the "?") by using "nc" and it works, ie the message is well
interpreted by the application :
>   $ LANG=C date +"<70>%b %d %R:%S server.domain test[1234]: > Message
message n?123 message 456" | nc -4 127.0.0.1 514
> 
> Why pdbtool can't parse that string ?
> 
> Regards,
> 
> Yann I.
> 


More information about the syslog-ng mailing list