New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

serverless-log-forwarding

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-log-forwarding - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

30

index.js

@@ -9,2 +9,3 @@ 'use strict';

this.options = options;
this.provider = this.serverless.getProvider('aws');

@@ -24,3 +25,5 @@ /* Hooks tell Serverless when to do what */

const service = this.serverless.service;
const stage = this.options.stage;
const stage = this.options.stage && this.options.stage.length > 0
? this.options.stage
: service.provider.stage;
if (service.custom.logForwarding.stages &&

@@ -38,2 +41,4 @@ service.custom.logForwarding.stages.indexOf(stage) === -1) {

};
} else if (this.serverless.service.resources.Resources === undefined) {
this.serverless.service.resources.Resources = {};
}

@@ -51,3 +56,2 @@ _.extend(this.serverless.service.resources.Resources, resourceObj);

const service = this.serverless.service;
const options = this.options;
// Checks if the serverless file is setup correctly

@@ -59,8 +63,3 @@ if (service.custom.logForwarding.destinationARN == null) {

// Get options and parameters to make resources object
const serviceName = service.service;
const awsProvider = this.serverless.getProvider('aws');
const arn = service.custom.logForwarding.destinationARN;
const stage = options.stage && options.stage.length > 0
? options.stage
: service.provider.stage;
// Get list of all functions in this lambda

@@ -83,5 +82,3 @@ const functions = _.keys(service.functions);

/* merge new SubscriptionFilter with current resources object */
const functionLogGroupId = awsProvider.naming.getLogGroupLogicalId(functions[i]);
const subscriptionFilter = LogForwardingPlugin.makeSubscriptionFilter(serviceName,
stage, arn, functions[i], filterPattern, functionLogGroupId);
const subscriptionFilter = this.makeSubscriptionFilter(arn, functions[i], filterPattern);
_.extend(resourceObj, subscriptionFilter);

@@ -95,15 +92,14 @@ }

* Makes a Subscription Filter object for given function name
* @param {String} serviceName name of current service
* @param {String} stage stage this lambda is being deployed to
* @param {String} arn arn of the lambda to forward to
* @param {String} functionName name of function to make SubscriptionFilter for
* @param {String} filterPattern filter pattern for the Subscription
* @param {String} functionLogGroupId name of the function Log Group to add as a dependency
* @return {Object} SubscriptionFilter
*/
static makeSubscriptionFilter(serviceName, stage, arn, functionName, filterPattern,
functionLogGroupId) {
const logGroupName = `/aws/lambda/${serviceName}-${stage}-${functionName}`;
makeSubscriptionFilter(arn, functionName, filterPattern) {
const functionObject = this.serverless.service.getFunction(functionName);
const logGroupName = this.provider.naming.getLogGroupName(functionObject.name);
const filterLogicalId = `SubscriptionFilter${this.provider.naming.getNormalizedFunctionName(functionName)}`;
const functionLogGroupId = this.provider.naming.getLogGroupLogicalId(functionName);
const filter = {};
filter[`SubscriptionFilter${functionName}`] = {
filter[filterLogicalId] = {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -110,0 +106,0 @@ Properties: {

{
"name": "serverless-log-forwarding",
"version": "1.1.4",
"version": "1.1.5",
"description": "a serverless plugin to forward logs to given lambda function",

@@ -24,3 +24,3 @@ "main": "index.js",

"scripts": {
"test": "node ./node_modules/istanbul/lib/cli.js cover _mocha -- -R spec && node ./node_modules/istanbul/lib/cli.js check-coverage --line 70 coverage/coverage.json",
"test": "node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec && node ./node_modules/istanbul/lib/cli.js check-coverage --line 70 coverage/coverage.json",
"lint": "eslint ."

@@ -27,0 +27,0 @@ },

@@ -132,3 +132,3 @@ const chai = require('chai');

},
SubscriptionFiltertestFunctionOne: {
SubscriptionFilterTestFunctionOne: {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -145,3 +145,3 @@ Properties: {

},
SubscriptionFiltertestFunctionTwo: {
SubscriptionFilterTestFunctionTwo: {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -178,3 +178,3 @@ Properties: {

},
SubscriptionFiltertestFunctionOne: {
SubscriptionFilterTestFunctionOne: {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -191,3 +191,3 @@ Properties: {

},
SubscriptionFiltertestFunctionTwo: {
SubscriptionFilterTestFunctionTwo: {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -221,3 +221,3 @@ Properties: {

},
SubscriptionFiltertestFunctionOne: {
SubscriptionFilterTestFunctionOne: {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -234,3 +234,3 @@ Properties: {

},
SubscriptionFiltertestFunctionTwo: {
SubscriptionFilterTestFunctionTwo: {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -267,3 +267,3 @@ Properties: {

},
SubscriptionFiltertestFunctionOne: {
SubscriptionFilterTestFunctionOne: {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -280,3 +280,3 @@ Properties: {

},
SubscriptionFiltertestFunctionTwo: {
SubscriptionFilterTestFunctionTwo: {
Type: 'AWS::Logs::SubscriptionFilter',

@@ -283,0 +283,0 @@ Properties: {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc