Re: How to make svlogd send logs via UDP

From: Nicolas de Bari Embriz Garcia Rojas <nbari_at_dalmp.com>
Date: Sat, 6 Feb 2016 06:25:07 +0100

Hi, yes I am using this within FreeBSD, also wondering if it is posible to
use a domain name instead of an IP, since in many cases the remote log
server is balanced something like:

log.domain.tld IN:
10.0.0.2
10.0.0.3
10.0.0.4

Thanks in advance.



On Sat, Feb 6, 2016 at 1:52 AM, Guillermo <gdiazhartusch_at_gmail.com> wrote:

> Hi,
>
> 2016-02-04 11:11 GMT-03:00 Nicolas de Bari Embriz Garcia Rojas:
> >
> > 4909 svlogd CALL sendto(0x7,0x609580,0x3c,0,0x609c3c,0x10)
> > 4909 svlogd STRU struct sockaddr { AF_UNSPEC, unknown address
> family }
> > 4909 svlogd RET sendto -1 errno 47 Address family not supported by
> protocol family
> > [...]
> > Any ideas ?
>
> Looking at svlogd.c, it seems the logdir_open() function, which among
> other things parses the 'config' file in the log directory, doesn't
> set the udpaddr.sin_family field in the struct logdir it is given. On
> my GNU/Linux system, strace shows sendto() is indeed given a struct
> sockaddr_in argument with an AF_UNSPEC address family, but the call
> succeeds regardless. My guess is that since it is passed an AF_INET
> socket, the implementation just assumes the struct sockaddr * argument
> points to a struct sockaddr_in, and doesn't check the sa_family field.
> Your system's implementation seems stricter, is that a BSD?
>
> Anyway, you may want to see if the attached patch makes your system
> happy. Linux strace says it should work...
> G.
>
> --- old/src/svlogd.c 2014-08-10 15:22:34.000000000 -0300
> +++ new/src/svlogd.c 2016-02-04 22:53:52.910965361 -0300
> _at__at_ -430,6 +430,7 @@
> ld->name =(char*)fn;
> ld->ppid =0;
> ld->match ='+';
> + ld->udpaddr.sin_family =AF_INET;
> ld->udpaddr.sin_port =0;
> ld->udponly =0;
> while (! stralloc_copys(&ld->prefix, "")) pause_nomem();
>
Received on Sat Feb 06 2016 - 05:25:07 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC