Skip to content

Commit 8a53d27

Browse files
committed
MERGE PR12
2 parents 9ee41b0 + 75e9d43 commit 8a53d27

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

cloudwatchlogs/cloudwatchlogs.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
///////////////////////////////////////////////////////////////////////////////////////////////////////////
2+
// Remember to change the hostname and path to match your collection API and specific HTTP-source endpoint
3+
// See more at: https://service.sumologic.com/help/Default.htm#Collector_Management_API.htm
4+
///////////////////////////////////////////////////////////////////////////////////////////////////////////
5+
var sumoEndpoint = 'https://collectors.sumologic.com/receiver/v1/http/<XXX>'
16

27
var https = require('https');
38
var zlib = require('zlib');
9+
var url = require('url');
410

511
exports.handler = function(event, context) {
6-
///////////////////////////////////////////////////////////////////////////////////////////////////////////
7-
// Remember to change the hostname and path to match your collection API and specific HTTP-source endpoint
8-
// See more at: https://service.sumologic.com/help/Default.htm#Collector_Management_API.htm
9-
///////////////////////////////////////////////////////////////////////////////////////////////////////////
10-
var options = { 'hostname': 'collectors.sumologic.com',
11-
'path': 'https://collectors.sumologic.com/receiver/v1/http/<XXX>',
12-
'method': 'POST'
13-
};
12+
var urlObject = url.parse(sumoEndpoint);
13+
14+
var options = { 'hostname': urlObject.hostname,
15+
'path': urlObject.pathname,
16+
'method': 'POST'
17+
};
1418
var zippedInput = new Buffer(event.awslogs.data, 'base64');
1519

1620
zlib.gunzip(zippedInput, function(e, buffer) {

cloudwatchlogs/cloudwatchlogs_lambda.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
///////////////////////////////////////////////////////////////////////////////////////////////////////////
2+
// Remember to change the hostname and path to match your collection API and specific HTTP-source endpoint
3+
// See more at: https://service.sumologic.com/help/Default.htm#Collector_Management_API.htm
4+
///////////////////////////////////////////////////////////////////////////////////////////////////////////
5+
var sumoEndpoint = 'https://collectors.sumologic.com/receiver/v1/http/<XXX>'
6+
17
var https = require('https');
28
var zlib = require('zlib');
9+
var url = require('url');
310

411
exports.handler = function(event, context) {
5-
///////////////////////////////////////////////////////////////////////////////////////////////////////////
6-
// Remember to change the hostname and path to match your collection API and specific HTTP-source endpoint
7-
// See more at: https://service.sumologic.com/help/Default.htm#Collector_Management_API.htm
8-
///////////////////////////////////////////////////////////////////////////////////////////////////////////
9-
var options = {
10-
'hostname': 'collectors.sumologic.com',
11-
'path': 'https://collectors.sumologic.com/receiver/v1/http/<XXX>',
12-
'method': 'POST'
13-
};
12+
var urlObject = url.parse(sumoEndpoint);
13+
14+
var options = { 'hostname': urlobject.hostname,
15+
'path': urlObject.pathname,
16+
'method': 'POST'
17+
};
18+
1419
var zippedInput = new Buffer(event.awslogs.data, 'base64');
1520

1621
zlib.gunzip(zippedInput, function(e, buffer) {

0 commit comments

Comments
 (0)