You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating multiple loggers with winston.loggers.add('id', params) to create loggers in containers, winston-syslog doesn't log, other than for the primary process when protocol is set to udp4 (it works with tcp4). This is on Node.js v16.14.0 on Windows 10.
Potential Solution
Set this.socket.bind() to this.socket.bind({ port: 0, exclusive: true }) around line 323 of winston-syslog.js.
Apparently not a problem in Linux. This, despite node.js documentation mentioning, "When exclusive is true, however, the handle is not shared and attempted port sharing results in an error."
The text was updated successfully, but these errors were encountered:
GreenHex
changed the title
Winston containers problem and solution with winston-syslog
Winston containers problem with winston-syslog and solution
Sep 19, 2022
We don't have enough active contributors on the project to investigate theses kinds of issues unfortunately, but PRs from the community are welcomed and will be reviewed.
I'm curious what this.socket.bind({ port: 0, exclusive: true }) does, compared to this.socket.bind() (I have not looked at this code in ages and don't know the details of the API). I wonder if that would break any use cases or expected behavior. It's also weird that the problematic behavior you report seems so specific (Windows + udp4) -- would be good to maybe understand that a bit better.
Unfortunately, I don't have a deeper insight into what is happening in this case. After struggling for days trying to trace the problem, and then deciding to write a logger myself, the solution was just a guess - that workers were not forwarding the logging request to the parent, and the solution was to route the request or to broadcast to all ports.
I will continue to look into this, and let you know, as the solution does not appear efficient. I myself am baffled by the 'exclusive' parameter, which works counterintuitively. Maybe all worker processes are trying to bind to a single port, and failing.
The Problem
When creating multiple loggers with winston.loggers.add('id', params) to create loggers in containers, winston-syslog doesn't log, other than for the primary process when protocol is set to udp4 (it works with tcp4). This is on Node.js v16.14.0 on Windows 10.
Potential Solution
Set
this.socket.bind(
) tothis.socket.bind({ port: 0, exclusive: true })
around line 323 of winston-syslog.js.Apparently not a problem in Linux. This, despite node.js documentation mentioning, "When exclusive is true, however, the handle is not shared and attempted port sharing results in an error."
The text was updated successfully, but these errors were encountered: