mhart / gelf-stream

A node.js stream to send JS objects to a Graylog2 server (in GELF format)
Other
29 stars 13 forks source link

Error address not found #18

Open gvko opened 7 years ago

gvko commented 7 years ago

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'
mhart commented 7 years ago

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

gvko commented 7 years ago

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

mhart commented 7 years ago

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 commented 6 years ago

@galioy did you have any luck with UDP?