[syslog-ng][PATCH] syslog-ng-1.6.5+20041206 fixes missing facility/priority in afinet.c

Balazs Scheidler syslog-ng@lists.balabit.hu
Mon, 13 Dec 2004 13:31:05 +0100


On Mon, 2004-12-13 at 09:44, Roberto Nibali wrote:
> Hi Bazsi,
> 
> >>I'm under the distinct impression that something like that has already been 
> >>addressed in the past. Maybe it was a copy'n'paste error or so ...
> > 
> > it was removed by intent, as that code path is processed when template()
> > is specified by the user. if you want to include the pri/level then you
> > need to add it into your template:
> > 
> > destination d_udp { udp("1.2.3.4" template("<$TAG>$DATE $HOST $MSG\n");
> > };
> 
> Colour me stupid but this does not provide me with the same functionality. If I 
> provide the prio/level (it's translated into hex, when you read the tcpdump 
> output; which I don't recall being valid by the specs) the code fails in log.c:
> 
> Jan  1 00:00:00 unparseable log message: \"<4e>Dec 13 07:05:01 [snip]\"
> 
> This is the code snippet that gets hit:
> 
>      if (left && src[0] == '<') {
>          src++;
>          left--;
>          pri = 0;
>          while (left && *src != '>') {
>              if (isdigit(*src)) {
>                  ^^^^^^^
>      my tcpdump shows me 4e for my prio/level combo I send
> 
>                  pri = pri * 10 + ((*src) - '0');
>              }
>              else {
>                  lm->msg = c_format_cstring("unparseable log message: \"%s\"", 
> length, data);
>                  lm->pri = LOG_SYSLOG | LOG_ERR;
>                  return;
>              }
>              src++;
>              left--;
>          }
>          lm->pri = pri;
>          if (left) {
>              src++;
>              left--;
>          }
> 
> Please consider applying the patch, or tell me what I'm missing. I'll patch my 
> local copy of syslog-ng because I'm honestly unable to configure it they way you 
> think it should be working. Thanks and best regards,


sorry, it is not the TAG macro, but the PRI macro, so it should read:

template("<$PRI>$DATE $HOST $MSG\n");

-- 
Bazsi