[syslog-ng] About Syslog-ng Macro

Yu Watanabe yu.watanabe at jp.fujitsu.com
Mon Apr 7 07:26:27 CEST 2008


Hello Joe,

I have found the reason why the multibyte code is not 
showing properly.

I assume that the escape procedure of the template function is 
ON for default.

Inside the macros.c there's a line which corresponds to this:

    129           if (str[i] == '\'' || str[i] == '"' || str[i] == '\\')
    130             {
    131               g_string_append_c(result, '\\');
    132               g_string_append_c(result, str[i]);
    133             }
    134           else if (str[i] < ' ')
    135             {
    136               g_string_sprintfa(result, "\\%03o", (unsigned int) str[i]);
    137             }
    138           else
    139             g_string_append_c(result, str[i]);

If the ascii code is smaller than the space it appends the '\' to the single byte.
However if the certain byte is counterpart of the multibyte code, 
this is not will not work properly. I do not know why it jumps into this
else if branch if it is multibyte code though...

So in order escape from this procedure, one of the solution is
to set the 'template_escape(no)' or else modify the source code.

I have to consider about the affection of this setting but 
currently it seems ok.

Thank you.

Fegan, Joe さんは書きました:
>Hello Watanabe-san,
>
>Do you think this is this a difference between the "program" driver the "file" driver?
>Or a problem with the $MSG macro in general?
>
>If you use template t_temp to write to a file, do Japanese characters appear correctly in that file?
>
>Joe.
>
>-----Original Message-----
>From: syslog-ng-bounces at lists.balabit.hu [mailto:syslog-ng-bounces at lists.balabit.hu] On Behalf Of Yu Watanabe
>Sent: 04 April 2008 09:24
>To: syslog-ng at lists.balabit.hu
>Subject: [syslog-ng] About Syslog-ng Macro
>
>TO : Syslog-NG Developers
>
>Hello ,
>
>I have a question regarding to the syslog-ng macros that is useful in the syslog.conf.
>
>I am using syslog-ng in the follwoing development.
>
>1. Linux **** 2.6.9-42.EL #1 Sat Aug 12 09:17:58 CDT 2006 i686 i686 i386 GNU/Linux
>2. CentOS release 4.4 (Final)
>3. LANG=ja_JP.eucJP
>
>However, whenever I try to ouput the multibye code(EUC) through the macro such as $MSG
>the message do not show properly.
>
>I am defining the following template and destination function in the config file.
>
>template t_temp { template("$S_YEAR-$S_MONTH-$S_DAY $S_HOUR:$S_MIN:$S_SEC $SOURCEIP $MSG\n"); };
>destination d_log { program("/tmp/stdin2phpsyslogng.pl > /tmp/stdin2phpsyslogng.log 2>&1" template(t_temp)); };
>
>But in the log file which is created through the file driver the japanese code shows properly.
>
>I am defining the following definition
>
>destination host_splitter { file( "/tmp/$HOST.log" owner(root) group(root) perm(0644) dir_perm(0755) create_dirs(yes)); };
>
>I am looking in the source code but I am having trouble with the investigation.
>
>If its possible, I would like to know why this is happening.
>
>Is there any way to modify the macro problem?
>
>Thank you!
>
>Yu Watanabe
>
>______________________________________________________________________________
>Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
>FAQ: http://www.campin.net/syslog-ng/faq.html
>
>______________________________________________________________________________
>Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
>FAQ: http://www.campin.net/syslog-ng/faq.html
>
>



More information about the syslog-ng mailing list