lazywithclass / winston-cloudwatch

Send logs to Amazon Cloudwatch using Winston.
MIT License
258 stars 104 forks source link

Use modular cloudwatch package instead of entire aws sdk. #172

Closed peakyDicers closed 2 years ago

peakyDicers commented 2 years ago

I wanted to use aws' new modular packages instead of the full aws sdk.

I made it so that the user only needs to have the @aws-sdk/client-cloudwatch-logs module. To do this, I had to remove the proxy option which uses the main AWS sdk. In my opinion, this project shouldn't need to touch that option anyway. I also update mocha to fix the audit issues.

Lastly, I updated the typescript definition. name for transport options is optional.

lazywithclass commented 2 years ago

First of all thanls for this! I will review as soon as I can, I have close to zero time now but your effort means a lot to me. Are you using your changes in production / staging environment?

peakyDicers commented 2 years ago

First of all thanls for this! I will review as soon as I can, I have close to zero time now but your effort means a lot to me. Are you using your changes in production / staging environment?

It's my pleasure, and no worries! Yes, I'm currently using it in a staging environment. It seems to work, but I've only used it very lightly for a half hour or so.

I saw somebody post an issue addressing this same issue and their solution as well, they mentioned that there was a change from error.code to error.name in the aws sdk which I haven't fixed in this PR.

lazywithclass commented 2 years ago

Can you reference that issue here please?

peakyDicers commented 2 years ago

Yes, here it is: https://github.com/lazywithclass/winston-cloudwatch/issues/160#issuecomment-916610465

sdesalas commented 2 years ago

+1

hectorgabucio commented 2 years ago

Im using @peakyDicers solution and it works. Im using it on staging and production environment, and I didnt encounter problems so far.

lazywithclass commented 2 years ago

Thanks for the feedback and the effort! Sorry for being so late I am swamped with work and uni study.

winston-cloudwatch@3.2.0 is out.

tkdave commented 2 years ago

Heads up. This PR broke the ability to set aws credentials in CloudwatchTransportOptions. https://github.com/lazywithclass/winston-cloudwatch/issues/181

3.1.1 is the last working version.

lazywithclass commented 2 years ago

Thanks @tkdave; if you have a solution for this issue feel free to send a PR, otherwise I will see if I can have a look in the next days, as it is a long standing issue.