qixotic / s3-to-logstore

AWS lambda function for parsing CloudFront / S3 / Cloudtrail logs and pushing events into Papertrail or other Winston transport of choice.
MIT License
10 stars 3 forks source link

Can't use in conjunction with winston-sns #1

Open acrespillo opened 8 years ago

acrespillo commented 8 years ago

I'm trying to parse Cloudfront logs and send it to aws sns using winston-sns, but I'm receiving lambda errors that get me stuck. Any ideas?

`var s3ToLogstore = require('s3-to-logstore'); var winston = require('winston'); require('winston-sns').SNS;

var format = 'cloudfront'; var transport = new winston.transports.SNS({ subscriber: 'subscriberid', topic_arn: 'arnid, subject: 'Print Report', level:'error', handleExceptions: true }); var options = { format: format, transport: transport, callback: function(error, lambdaCallback) { transport.close(); lambdaCallback(error); } }; export.handler = s3ToLogstore(options);`

I'm getting this generic error through lambda:

Syntax error in module 'printprocess': SyntaxError at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)

acrespillo commented 8 years ago

Hi that was just me screwing up with a "spelling" error. Having that solved I still unable to send to SNS... Any ideas?

var s3ToLogstore = require('s3-to-logstore');
var winston = require('winston');
require('winston-sns');

var format = 'cloudfront';

var transport = new winston.transports.SNS({
  subscriber: 'mysubid',
  topic_arn: 'myarnid',
  json: true
});

var options = {
  format: format,
  transport: transport,
  callback: function(error, lambdaCallback) {
    lambdaCallback(error);
  }
};
exports.handler = s3ToLogstore(options);