gelf-stream icon indicating copy to clipboard operation
gelf-stream copied to clipboard

Error address not found

Open gvko opened this issue 7 years ago • 4 comments

I'm setting up with the following implementation:

const stream = gelfStream.forBunyan('http://graylog-server/gelf', 12201);

const logger = bunyan.createLogger({
    name: serviceName,
    streams: [
      {
        level: 'info',
        stream: stream,
        formatter: 'pretty',
        period: '1d',
        count: 7
      },
      {
        level: 'error',
        stream: stream,
        formatter: 'pretty',
        period: '1d',
        count: 7
      }
    ]
  });

and upon lifting my application I get:

Error: getaddrinfo ENOTFOUND http://graylog-server/gelf
          at errnoException (dns.js:28:10)
          at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

I also tried with plain http://graylog-server (without the /gelf part).

I am sure the connection is working properly, because when I do a curl request - it works fine:

curl -X POST -H 'Content-Type: application/json' -d '{ "message": "UAHSDUHAUSDHUASHUS" }' 'http://graylog-server:12201/gelf'

gvko avatar Aug 11 '17 09:08 gvko

Hi @galioy – I'm not sure where the http:// came from – it should just be the host name.

Also, gelf-stream sends UDP messages: http://docs.graylog.org/en/2.2/pages/gelf.html#gelf-via-udp – so an http server won't work here unfortunately

mhart avatar Aug 11 '17 10:08 mhart

I did try w/o http:// as well, and I got the same result. :(

gvko avatar Aug 11 '17 11:08 gvko

Have you setup Graylog to use UDP? You can check if it works like this:

http://docs.graylog.org/en/2.3/pages/gelf.html#sending-gelf-messages-via-udp-using-netcat

mhart avatar Aug 11 '17 11:08 mhart

@galioy did you have any luck with UDP?

mhart avatar Sep 16 '17 13:09 mhart