gelf-stream
gelf-stream copied to clipboard
Error address not found
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'
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
I did try w/o http://
as well, and I got the same result. :(
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
@galioy did you have any luck with UDP?