winstonjs / winston-syslog

A syslog transport for winston
http://github.com/winstonjs/winston-syslog
MIT License
138 stars 119 forks source link

Unable to change appName without reinstantiation #199

Closed sigJoe closed 2 years ago

sigJoe commented 2 years ago

I'm working on a tool that runs custom batch processing on a Kinesis stream containing logs from different hosts/applications then forwards each entry to a log aggregator service. However, winston-syslog requires me to re-instantiate the transport/logger every time I want to change appName because appName is only passed to the Producer on instantiation whereas other parameters like localhost are passed on every call to Produce a log message. I'm using TLS for security and to maintain log sequence, so recreating the transport/logger loses time on reconnection latency, and also causes throttling issues with the target log aggregator service.

Here is an example of how I thought this should work:

transport = new winston.transports.Syslog({...})
logger = createLogger({...})
while ... {
    ...
    transport.localhost = ...
    transport.appName = ...
    logger.log(level, message)
}
DABH commented 2 years ago

Looks like we merged the PR that fixes this issue so I'll go ahead and close this issue. Planning on doing an NPM release now.