Logs forwarded with different priority

General discussions here

Moderator: rgerhards

Re: Logs forwarded with different priority

Postby rgerhards on Mon Jul 14, 2008 11:40 am

OK, I am getting a grip on this here, too. At least the part where it can not at all send via UDP. I experience the same problem. Will work on that, first.
User avatar
rgerhards
Site Admin
 
Posts: 1667
Joined: Thu Feb 13, 2003 11:57 am

Professional Services Information

  • Custom written rsyslog.conf?
  • Maintenance Contract?
  • Installation support?

Re: Logs forwarded with different priority

Postby rgerhards on Mon Jul 14, 2008 1:24 pm

I am stuck on that one. getaddrinfo() always fails when called with a numerical port (and we always call it with a numerical port...). I think I'll need to find a place where to ask for advise on freeBSD. If someone can explain. I have written a test program

Code: Select all
#include <stdio.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>

void main()
{
        int iErr;
        struct addrinfo *res;
        struct addrinfo hints;

        printf("trying with char service\n");
        iErr = getaddrinfo("localhost", "syslog", NULL, &res);
        if(iErr == 0) {
                printf("success\n");
        } else {
                printf("could not get addrinfo for hostname (error %d): %s\n",
                          iErr, gai_strerror(iErr));
        }

        printf("trying with numerical service, no hints\n");
        iErr = getaddrinfo("localhost", "514", NULL, &res);
        if(iErr == 0) {
                printf("success\n");
        } else {
                printf("could not get addrinfo for hostname (error %d): %s\n",
                          iErr, gai_strerror(iErr));
        }

        printf("trying with numerical service, and AI_NUMERICSERV hint\n");
        memset(&hints, 0, sizeof(hints));
        /* port must be numeric, because config file syntax requires this */
        hints.ai_flags = AI_NUMERICSERV;
        iErr = getaddrinfo("localhost", "514", &hints, &res);
        if(iErr == 0) {
                printf("success\n");
        } else {
                printf("could not get addrinfo for hostname (error %d): %s\n",
                          iErr, gai_strerror(iErr));
        }
}


It shows that getaddrinfo only works if a non-numeric service is given:

Code: Select all
trying with char service
success
trying with numerical service, no hints
could not get addrinfo for hostname (error 9): servname not supported for ai_socktype
trying with numerical service, and AI_NUMERICSERV hint
could not get addrinfo for hostname (error 9): servname not supported for ai_socktype


Rainer
User avatar
rgerhards
Site Admin
 
Posts: 1667
Joined: Thu Feb 13, 2003 11:57 am

Re: Logs forwarded with different priority

Postby rgerhards on Mon Jul 14, 2008 1:30 pm

lol... always when I think I am done, I have an idea. I played a bit with the ai_socktype hint. It looks like freeBSD has a bug where the default (0) leads to improper handling. If I replace it with SOCK_DGRAM (or SOCK_STREAM), I get resolution. I'll now check how this affects rsyslog.
User avatar
rgerhards
Site Admin
 
Posts: 1667
Joined: Thu Feb 13, 2003 11:57 am

Re: Logs forwarded with different priority

Postby rgerhards on Mon Jul 14, 2008 1:45 pm

OK, now the UDP send bug is fixed (commit in git HEAD). I now see if I can also reproduce the PRI problem...
User avatar
rgerhards
Site Admin
 
Posts: 1667
Joined: Thu Feb 13, 2003 11:57 am

Re: Logs forwarded with different priority

Postby rgerhards on Mon Jul 14, 2008 2:25 pm

and more good news: I can reproduce the priority problem on FreeBSD. Guess that brings us much closer to a solution :)
User avatar
rgerhards
Site Admin
 
Posts: 1667
Joined: Thu Feb 13, 2003 11:57 am

Re: Logs forwarded with different priority

Postby rgerhards on Mon Jul 14, 2008 2:47 pm

... and I got it. It is a difference in the LOG_MAKEPRI macro. Under BSD, it assumes that the shift of facility is already done, thus simply adding the two values. Under Linux, it shifts facility by 3 bits (multiply by 8) and than adds the values. I am not sure what is correct, but I'll now do the logic without the macro and thus consistent. Expect fix soon ;)
User avatar
rgerhards
Site Admin
 
Posts: 1667
Joined: Thu Feb 13, 2003 11:57 am

Re: Logs forwarded with different priority

Postby rgerhards on Mon Jul 14, 2008 2:57 pm

Fix written and committed. So git HEAD now contains fixes for everything you reported (good day ;)). Please give it a try and report back.
User avatar
rgerhards
Site Admin
 
Posts: 1667
Joined: Thu Feb 13, 2003 11:57 am

Re: Logs forwarded with different priority

Postby hkspvt on Mon Jul 14, 2008 4:03 pm

This one is fixed too. Thanks!

-HKS
hkspvt
Frequent Poster
 
Posts: 98
Joined: Thu Jun 26, 2008 6:31 pm

Re: Logs forwarded with different priority

Postby rgerhards on Tue Jul 15, 2008 7:42 am

Thanks for the feedback, that's good to know :)
User avatar
rgerhards
Site Admin
 
Posts: 1667
Joined: Thu Feb 13, 2003 11:57 am

Google Ads


Previous

Return to General

Who is online

Users browsing this forum: No registered users and 0 guests

cron