Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-es-proxy-logs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-es-proxy-logs - npm Package Compare versions

Comparing version 3.0.7-rc0 to 3.0.7-rc1

15

dist/index.js

@@ -228,17 +228,16 @@ "use strict";

addLogProcesser() {
const { index, endpoint, tags, securityGroupIds, subnetIds, sqsQueue } = this.custom().esLogs;
const { index, endpoint, tags, securityGroupIds, subnetIds } = this.custom().esLogs;
const tagsStringified = tags ? JSON.stringify(tags) : /* istanbul ignore next */ '';
const dirPath = path_1.default.join(this.serverless.config.servicePath, this.logProcesserDir);
const filePath = path_1.default.join(dirPath, 'syslog.py');
const handler = `${this.logProcesserDir}/syslog.handler`;
const filePath = path_1.default.join(dirPath, 'index.js');
const handler = `${this.logProcesserDir}/index.handler`;
const name = `${this.serverless.service.service}-${this.options.stage}-es-logs-plugin`;
fs_extra_1.default.ensureDirSync(dirPath);
fs_extra_1.default.copySync(path_1.default.resolve(__dirname, '../templates/code/logsToEs.py'), filePath);
fs_extra_1.default.copySync(path_1.default.resolve(__dirname, '../templates/code/logsToEs.js'), filePath);
this.serverless.service.functions[this.logProcesserName] = {
description: 'Serverless ES Logs Plugin',
environment: {
AWS_SQS_DLQ_NAME: sqsQueue,
ELASTICSEARCH_GROUP: index,
ELASTICSEARCH_INDEX: index,
ES_ENDPOINT: endpoint,
ES_INDEX_PREFIX: index,
ES_TAGS: tagsStringified,
},

@@ -254,3 +253,3 @@ events: [],

},
runtime: 'python3.7',
runtime: 'nodejs8.10',
timeout: 60,

@@ -257,0 +256,0 @@ tracing: true,

{
"name": "serverless-es-proxy-logs",
"version": "3.0.7-rc0",
"version": "3.0.7-rc1",
"license": "MIT",

@@ -71,3 +71,4 @@ "description": "A Serverless plugin to transport logs to ElasticSearch",

"fs-extra": "8.1.0",
"lodash": "4.17.15"
"lodash": "4.17.15",
"socket.io-client": "^2.2.0"
},

@@ -74,0 +75,0 @@ "devDependencies": {

// v1.1.2
var https = require('https');
var zlib = require('zlib');
var crypto = require('crypto');
import io from 'socket.io-client';
var endpoint = process.env.ES_ENDPOINT;

@@ -40,27 +41,35 @@ var indexPrefix = process.env.ES_INDEX_PREFIX;

//socket data
const socket = io(endpoint);
socket.on('connect', () => {
console.log('Successfully connected to es endpoint');
console.log('Emitting data');
socket.emit(elasticsearchBulkPayload);
console.log('sent data');
});
// post documents to the Amazon Elasticsearch Service
put(elasticsearchBulkPayload, function(error, success, statusCode, failedItems) {
console.log('Response: ' + JSON.stringify({
"statusCode": statusCode
}));
if (error) {
console.log('Error: ' + JSON.stringify(error, null, 2));
if (failedItems && failedItems.length > 0) {
console.log("Failed Items: " +
JSON.stringify(failedItems, null, 2));
var failedLogs = findFailedLogs(failedItems, elasticsearchBulkArray);
failedLogs.forEach( failedLog => {
console.log("Failed log content: " + JSON.stringify(failedLog, null, 2));
});
}
context.fail(JSON.stringify(error));
} else {
console.log('Success: ' + JSON.stringify(success));
context.succeed('Success');
}
});
// put(elasticsearchBulkPayload, function(error, success, statusCode, failedItems) {
// console.log('Response: ' + JSON.stringify({
// "statusCode": statusCode
// }));
//
// if (error) {
// console.log('Error: ' + JSON.stringify(error, null, 2));
//
// if (failedItems && failedItems.length > 0) {
// console.log("Failed Items: " +
// JSON.stringify(failedItems, null, 2));
//
// var failedLogs = findFailedLogs(failedItems, elasticsearchBulkArray);
// failedLogs.forEach( failedLog => {
// console.log("Failed log content: " + JSON.stringify(failedLog, null, 2));
// });
// }
//
// context.fail(JSON.stringify(error));
// } else {
// console.log('Success: ' + JSON.stringify(success));
// context.succeed('Success');
// }
// });
});

@@ -67,0 +76,0 @@ };

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