Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/s3_lambda_es.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ var esDomain = {
};
var endpoint = new AWS.Endpoint(esDomain.endpoint);
var s3 = new AWS.S3();
var totLogLines = 0; // Total number of log lines in the file
var numDocsAdded = 0; // Number of log lines added to ES so far

/*
* The AWS credentials are picked up from the environment.
Expand Down Expand Up @@ -112,7 +110,12 @@ function postDocumentToES(doc, context) {
/* Lambda "main": Execution starts here */
exports.handler = function(event, context) {
console.log('Received event: ', JSON.stringify(event, null, 2));


// Create counters inside handler - Lambda may reuse container
// so these needs to be reset on each execution.
var totLogLines = 0; // Total number of log lines in the file
var numDocsAdded = 0; // Number of log lines added to ES so far

/* == Streams ==
* To avoid loading an entire (typically large) log file into memory,
* this is implemented as a pipeline of filters, streaming log data
Expand Down