[syslog-ng]$YEAR/$MONTH/$DAY generates always 2002/12/31

Serge Torop syslog-ng@lists.balabit.hu
Tue, 3 Feb 2004 12:43:54 +0300 (MSK)


On Tue, 2 Dec 2003, Niels Burmeister wrote:

> Am 2003.12.02 12:36 schrieb Piotr WoliƄski:
> > Hello,
> > 
> > I have PLD Linux kernel 2.4.20 and syslog-ng-1.6.0-0.rc3.2
> > I put into into syslog-ng.conf lines (for test purpose):
> [...]
> > Now i can see directiories like that:
> > /var/log/hosts/localhost/2003/2003/12/01
> > /var/log/hosts/localhost/2003/2003/12/02
> > that's OK.
> > 
> > But also:
> > /var/log/hosts/localhost/2002/12/31
> > 
> > Inside that dir files:
> > auth, authpriv, local7.
> 
> upgrade to >=1.6.0rc4, it's a known bug

That "bug" is still there, but the problem appears to come from the
locale settings (locale).

I tried to strace data from logger to syslog-ng (see the
contents of my syslog-ng.conf at the end of this message).

I.

In my case, LC_TIME="ru_RU.koi8r".

1. logger -p local4.info abcdefgh
2. strace -p syslog-ng.pid -t

15:09:03 read(9, "<166>\361\316\327 28 15:09:03 tsp: abcdef"..., 2048) =  35
                  ^^^^^^^^^^^^^^^^^ - russian date format
                                      of "15:09:03 Wed Jan 28"


15:09:03 time(NULL)                     = 1075291743
15:09:03 time(NULL)                     = 1075291743
15:09:03 open("/var/log/messages.local4.info",
O_WRONLY|O_NONBLOCK|O_APPEND|O_CR
EAT|O_NOCTTY|O_LARGEFILE, 0600) = 10
15:09:03 chown32(0x8083ec0, 0, 0)       = 0
15:09:03 chmod("/var/log/messages.local4.info", 0600) = 0
15:09:03 fcntl64(10, F_GETFL)           = 0x8c01 (flags
O_WRONLY|O_NONBLOCK|O_AP
PEND|O_LARGEFILE)
15:09:03 fcntl64(10, F_SETFL, O_WRONLY|O_NONBLOCK|O_APPEND|O_LARGEFILE) = 0
15:09:03 fcntl64(10, F_SETFD, FD_CLOEXEC) = 0
15:09:03 time(NULL)                     = 1075291743
15:09:03 time(NULL)                     = 1075291743
15:09:03 open("/var/drweb/log/mail/drweb-postfix-31.12.2003",
O_WRONLY|O_NONBLOC
K|O_APPEND|O_CREAT|O_NOCTTY|O_LARGEFILE, 0600) = 20
15:09:03 chown32(0x8076a30, 0, 0)       = 0
15:09:03 chmod("/var/drweb/log/mail/drweb-postfix-31.12.2003", 0600) = 0
15:09:03 fcntl64(20, F_GETFL)           = 0x8c01 (flags
O_WRONLY|O_NONBLOCK|O_AP
PEND|O_LARGEFILE)
15:09:03 fcntl64(20, F_SETFL, O_WRONLY|O_NONBLOCK|O_APPEND|O_LARGEFILE) = 0
15:09:03 fcntl64(20, F_SETFD, FD_CLOEXEC) = 0
15:09:03 time(NULL)                     = 1075291743
15:09:03 time(NULL)                     = 1075291743
15:09:03 time(NULL)                     = 1075291743
15:09:03 write(20, "\361\316\327 28 15:09:03 canopus tsp: abc"..., 38) = 38
15:09:03 write(10, "\361\316\327 28 15:09:03 canopus tsp: abc"..., 38) = 38
15:09:03 read(9, "", 2048)              = 0
15:09:03 time(NULL)                     = 1075291743
15:09:03 time(NULL)                     = 1075291743
15:09:03 close(9)

This resulted in the generation of 'drweb-postfix-31.12.2003' file
in addition to 'drweb-postfix-28.01.2004' (the current date was
'Wed Jan 28 17:42:48 MSK 2004'), and other application (not "logger"
write to drweb-postfix-28.01.2004.

II.

   I changed LC_TIME="ru_RU.koi8r" to LC_TIME="en_US" and
   syslog-ng worked fine:

   1. logger -p local4.info abcdefgh
   2. {canopus} fgrep abcde drweb-postfix-28.01.2004
      Jan 28 17:45:59 canopus tsp: abcdefgh
   3. No 'drweb-postfix-31.12.2003' was generated

Dear author, is it possible to fix (add code to resolve non 
en_US locale) this problem?

Many thanks in advance.


syslog-ng.conf:

destination d_drwebp {
file("/var/drweb/log/mail/drweb-postfix-$DAY.$MONTH.$YEAR"); };
filter f_filter19     { facility(local4); };
log { source(s_sys); filter(f_filter19); destination(d_drwebp); };

-- 
Serge P. Torop
St.Petersburg, Russia