|
| 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>' |
1 | 6 |
|
2 | 7 | var https = require('https'); |
3 | 8 | var zlib = require('zlib'); |
| 9 | +var url = require('url'); |
4 | 10 |
|
5 | 11 | 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 | + }; |
14 | 18 | var zippedInput = new Buffer(event.awslogs.data, 'base64'); |
15 | 19 |
|
16 | 20 | zlib.gunzip(zippedInput, function(e, buffer) { |
|
0 commit comments