Search code examples
node.jsbrowserifyaws-lambdalogentriesserverless-framework

Is there a way to send data to Logentries in a NodeJS + Browserify context?


I am trying to send data to Logentries from an AWS Lambda function, created using the JAWS Framework (which is now the Serverless Framework), which uses Browserify as its default builder. However...

Is there some way to send data to Logentries in this situation?

I looked briefly at connecting Logentries to AWS CloudWatch directly, but the option for enabling that (via Logentries) says "Enable Cloudwatch & infrastructure information", whereas I'm just looking for a way to feed specific CloudWatch streams into specific Logentries log sets, and I don't need any of the infrastructure information.

EDIT:
Based on feedback from Logentries support staff, I ended up using an HTTP POST API that they have (not to be confused with their deprecated HTTP PUT API). Here's the code I used:
https://github.com/silinternational/lambda-le-logger


Solution

  • You could use xmlhttprequest to define a global XMLHttpRequest so you can use le_js in Node:

    global.XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
    var LE = require('le_js');
    ...