[syslog-ng] Trouble with timezone()

anthony lineham anthony.lineham at alliedtelesis.co.nz
Sun Dec 10 21:18:33 CET 2006


Thanks for the patch. I downloaded the latest snapshot and it now
accepts values greater than 12 hours.
However, there seems to be a new bug introduced. I now get an error
message logged regardless
of the time offset I enter.
eg
2006 Dec 11 09:09:23 syslog.err syslog-ng[67]: Bogus timezone spec,
must be in the format [+-]HH:MM, offset must be less than 24:00;
value=\'05:00\'

This seems to be due to the removal of the return TRUE in the patch and
latest snapshot
-       if (hours <= 12 && mins <= 60)
+      if ((hours < 24 && mins <= 60) || (hours == 24 && mins == 0))
         {
           *timezone = sign * (hours * 3600 + mins * 60);
-           return TRUE;
         }

Regards
Anthony
 
>>> Balazs Scheidler <bazsi at balabit.hu> 12/08/06 9:40 PM >>> 
On Fri, 2006- 12- 08 at 08:58 +1300, anthony lineham wrote:
> I saw it in the html documentation that came with 2.0rc3, in Table
3.6.
> Common options for destination drivers.
> Here is the text:
> timezone()  timezone offset in seconds  unspecified   Convert
> timestamps to a different timezone as specified by this option. If
this
> option is not specified then the original timezone information in
the
> message is used. 
> 
> Is the name of the option also incorrect? I noticed you referred to
> "time_zone" rather than "timezone". Both are present in the
> documentation that I have.

This is a docbug, a global option named timezone() does not exist
(anymore). You either need to use source_time_zone(), dest_time_zone()
settings.

If I remember correctly, there was a timezone related fix after 2.0.0
was released, so you should be using the latest snapshot. I really
ought
to do a release soon.

The 12 hours limitation in timezone offsets also seem to be a bug, the
patch below fixes it. Tomorrow's snapshot should include both the
patch
below, and the updated docs.

---  orig/src/cfg.c
+++ mod/src/cfg.c
@@ - 52,13 +52,12 @@ cfg_timezone_value(gchar *tz, glong *tim
       
       hours = (*tz -  '0') * 10 + *(tz+1) -  '0';
       mins = (*(tz+3) -  '0') * 10 + *(tz+4) -  '0';
-       if (hours <= 12 && mins <= 60)
+      if ((hours < 24 && mins <= 60) || (hours == 24 && mins == 0))
         {
           *timezone = sign * (hours * 3600 + mins * 60);
-           return TRUE;
         }
     }
-   msg_error("Bogus timezone spec, must be in the format [+- ]HH:MM",
+  msg_error("Bogus timezone spec, must be in the format [+- ]HH:MM,
offset must be less than 24:00",
             evt_tag_str("value", tz),
             NULL);
   return FALSE;





--  
Bazsi

_______________________________________________
syslog- ng maillist  -   syslog- ng at lists.balabit.hu
https://lists.balabit.hu/mailman/listinfo/syslog- ng
Frequently asked questions at http://www.campin.net/syslog-
ng/faq.html




More information about the syslog-ng mailing list