Skip to content

Commit 8ded008

Browse files
authored
Merge pull request #102 from SumoLogic/hpal_version_bug_fix
version bumped
2 parents 661a980 + c69bc03 commit 8ded008

File tree

3 files changed

+82
-81
lines changed

3 files changed

+82
-81
lines changed
Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2+
Transform: AWS::Serverless-2016-10-31
23
Description: 'This function is invoked by AWS CloudWatch events in response to state
34
change in your AWS resources which matches a event target definition. The event
45
payload received is then forwarded to Sumo Logic HTTP source endpoint.
@@ -24,56 +25,36 @@ Metadata:
2425
- SourceCategoryName
2526
- RemoveSumoResourcesOnDeleteStack
2627
ParameterLabels:
27-
CollectorName:
28-
default: Collector Name
29-
RemoveSumoResourcesOnDeleteStack:
30-
default: Remove Sumo Resources On Delete Stack
31-
SourceCategoryName:
32-
default: Source Category Name
33-
SourceName:
34-
default: Source Name
28+
SumoDeployment:
29+
default: Deployment Name
3530
SumoAccessID:
3631
default: Access ID
3732
SumoAccessKey:
3833
default: Access Key
39-
SumoDeployment:
40-
default: Deployment Name
41-
Outputs:
42-
CloudWatchEventFunction:
43-
Description: CloudWatchEvent Processor Function ARN
44-
Value:
45-
Fn::GetAtt:
46-
- CloudWatchEventFunction
47-
- Arn
48-
GuarddutyBenchmarkAppFolder:
49-
Description: Folder Name
50-
Value:
51-
Fn::GetAtt:
52-
- SumoGuardDutyBenchmarkApp
53-
- APP_FOLDER_NAME
34+
CollectorName:
35+
default: Collector Name
36+
SourceName:
37+
default: Source Name
38+
SourceCategoryName:
39+
default: Source Category Name
40+
RemoveSumoResourcesOnDeleteStack:
41+
default: Remove Sumo Resources On Delete Stack
5442
Parameters:
5543
CollectorName:
56-
Default: GuarddutyCollector
57-
Type: String
58-
RemoveSumoResourcesOnDeleteStack:
59-
AllowedValues:
60-
- true
61-
- false
62-
Default: false
63-
Description: To delete collector, sources and app when stack is deleted, set this
64-
parameter to true. Default is false.
65-
Type: String
66-
SourceCategoryName:
67-
Default: Labs/AWS/Guardduty
6844
Type: String
45+
Default: GuarddutyCollector
6946
SourceName:
47+
Type: String
7048
Default: GuarddutyEvents
49+
SourceCategoryName:
7150
Type: String
51+
Default: Labs/AWS/Guardduty
7252
SumoAccessID:
7353
Type: String
7454
SumoAccessKey:
7555
Type: String
7656
SumoDeployment:
57+
Type: String
7758
AllowedValues:
7859
- au
7960
- ca
@@ -83,6 +64,13 @@ Parameters:
8364
- us2
8465
- us1
8566
Description: Enter au, ca, de, eu, jp, us2, or us1
67+
RemoveSumoResourcesOnDeleteStack:
68+
AllowedValues:
69+
- true
70+
- false
71+
Default: false
72+
Description: To delete collector, sources and app when stack is deleted, set this
73+
parameter to true. Default is false.
8674
Type: String
8775
Resources:
8876
CloudWatchEventFunction:
@@ -105,77 +93,89 @@ Resources:
10593
Runtime: nodejs8.10
10694
Type: AWS::Serverless::Function
10795
SumoAppUtils:
96+
Type: AWS::Serverless::Application
10897
Properties:
10998
Location:
11099
ApplicationId: arn:aws:serverlessrepo:us-east-1:956882708938:applications/sumologic-app-utils
111-
SemanticVersion: 1.0.5
112-
Type: AWS::Serverless::Application
113-
SumoGuardDutyBenchmarkApp:
100+
SemanticVersion: 1.0.6
101+
SumoHostedCollector:
102+
Type: Custom::Collector
114103
Properties:
115-
AppName: Amazon GuardDuty Benchmark
116-
AppSources:
117-
gdbenchmark:
118-
Fn::Sub: _sourceCategory=${SourceCategoryName}
119-
Region:
120-
Ref: AWS::Region
121-
RemoveOnDeleteStack:
122-
Ref: RemoveSumoResourcesOnDeleteStack
123104
ServiceToken:
124105
Fn::GetAtt:
125106
- SumoAppUtils
126107
- Outputs.SumoAppUtilsFunction
108+
Region:
109+
Ref: AWS::Region
110+
CollectorType: Hosted
111+
RemoveOnDeleteStack:
112+
Ref: RemoveSumoResourcesOnDeleteStack
113+
CollectorName:
114+
Ref: CollectorName
127115
SumoAccessID:
128116
Ref: SumoAccessID
129117
SumoAccessKey:
130118
Ref: SumoAccessKey
131119
SumoDeployment:
132120
Ref: SumoDeployment
133-
Type: Custom::App
134121
SumoHTTPSource:
122+
Type: Custom::HTTPSource
135123
Properties:
136-
CollectorId:
124+
ServiceToken:
137125
Fn::GetAtt:
138-
- SumoHostedCollector
139-
- COLLECTOR_ID
140-
DateFormat: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
141-
DateLocatorRegex: .*"updatedAt":"(.*)".*
126+
- SumoAppUtils
127+
- Outputs.SumoAppUtilsFunction
142128
Region:
143129
Ref: AWS::Region
130+
SourceName:
131+
Ref: SourceName
144132
RemoveOnDeleteStack:
145133
Ref: RemoveSumoResourcesOnDeleteStack
146-
ServiceToken:
147-
Fn::GetAtt:
148-
- SumoAppUtils
149-
- Outputs.SumoAppUtilsFunction
150134
SourceCategory:
151135
Ref: SourceCategoryName
152-
SourceName:
153-
Ref: SourceName
136+
CollectorId:
137+
Fn::GetAtt:
138+
- SumoHostedCollector
139+
- COLLECTOR_ID
154140
SumoAccessID:
155141
Ref: SumoAccessID
156142
SumoAccessKey:
157143
Ref: SumoAccessKey
158144
SumoDeployment:
159145
Ref: SumoDeployment
160-
Type: Custom::HTTPSource
161-
SumoHostedCollector:
146+
DateFormat: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
147+
DateLocatorRegex: .*"updatedAt":"(.*)".*
148+
SumoGuardDutyBenchmarkApp:
149+
Type: Custom::App
162150
Properties:
163-
CollectorName:
164-
Ref: CollectorName
165-
CollectorType: Hosted
166-
Region:
167-
Ref: AWS::Region
168-
RemoveOnDeleteStack:
169-
Ref: RemoveSumoResourcesOnDeleteStack
170151
ServiceToken:
171152
Fn::GetAtt:
172153
- SumoAppUtils
173154
- Outputs.SumoAppUtilsFunction
155+
Region:
156+
Ref: AWS::Region
157+
AppName: Amazon GuardDuty Benchmark
158+
RemoveOnDeleteStack:
159+
Ref: RemoveSumoResourcesOnDeleteStack
160+
AppSources:
161+
gdbenchmark:
162+
Fn::Sub: _sourceCategory=${SourceCategoryName}
174163
SumoAccessID:
175164
Ref: SumoAccessID
176165
SumoAccessKey:
177166
Ref: SumoAccessKey
178167
SumoDeployment:
179168
Ref: SumoDeployment
180-
Type: Custom::Collector
181-
Transform: AWS::Serverless-2016-10-31
169+
Outputs:
170+
CloudWatchEventFunction:
171+
Description: CloudWatchEvent Processor Function ARN
172+
Value:
173+
Fn::GetAtt:
174+
- CloudWatchEventFunction
175+
- Arn
176+
GuarddutyBenchmarkAppFolder:
177+
Description: Folder Name
178+
Value:
179+
Fn::GetAtt:
180+
- SumoGuardDutyBenchmarkApp
181+
- APP_FOLDER_NAME

cloudwatchevents/guarddutybenchmark/template_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Resources:
9898
Properties:
9999
Location:
100100
ApplicationId: arn:aws:serverlessrepo:us-east-1:956882708938:applications/sumologic-app-utils
101-
SemanticVersion: 1.0.5
101+
SemanticVersion: 1.0.6
102102

103103
SumoHostedCollector:
104104
Type: Custom::Collector

kinesis/node.js/k2sl_lambda.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//////////////////////////////////////////////////////////////////////////////////
2-
// CloudWatch Logs to SumoLogic //
2+
// CloudWatch Logs to SumoLogic //
33
// https://github.com/SumoLogic/sumologic-aws-lambda/tree/master/cloudwatchlogs //
44
//////////////////////////////////////////////////////////////////////////////////
55

@@ -8,22 +8,22 @@ var SumoURL = process.env.SUMO_ENDPOINT;
88

99
// The following parameters override the sourceCategoryOverride, sourceHostOverride and sourceNameOverride metadata fields within SumoLogic.
1010
// Not these can also be overridden via json within the message payload. See the README for more information.
11-
var sourceCategoryOverride = process.env.SOURCE_CATEGORY_OVERRIDE || 'none'; // If none sourceCategoryOverride will not be overridden
12-
var sourceHostOverride = process.env.SOURCE_HOST_OVERRIDE || 'none'; // If none sourceHostOverride will not be set to the name of the logGroup
13-
var sourceNameOverride = process.env.SOURCE_NAME_OVERRIDE || 'none'; // If none sourceNameOverride will not be set to the name of the logStream
11+
var sourceCategoryOverride = process.env.SOURCE_CATEGORY_OVERRIDE || 'none'; // If none sourceCategoryOverride will not be overridden
12+
var sourceHostOverride = process.env.SOURCE_HOST_OVERRIDE || 'none'; // If none sourceHostOverride will not be set to the name of the logGroup
13+
var sourceNameOverride = process.env.SOURCE_NAME_OVERRIDE || 'none'; // If none sourceNameOverride will not be set to the name of the logStream
1414

1515
var retryInterval = process.env.RETRY_INTERVAL || 5000; // the interval in millisecs between retries
16-
var numOfRetries = process.env.NUMBER_OF_RETRIES || 3; // the number of retries
16+
var numOfRetries = process.env.NUMBER_OF_RETRIES || 3; // the number of retries
1717

1818
// CloudWatch logs encoding
19-
var encoding = process.env.ENCODING || 'utf-8'; // default is utf-8
19+
var encoding = process.env.ENCODING || 'utf-8'; // default is utf-8
2020

2121
// Include logStream and logGroup as json fields within the message. Required for SumoLogic AWS Lambda App
22-
var includeLogInfo = true; // default is true
22+
var includeLogInfo = true; // default is true
2323

2424
// Regex used to detect logs coming from lambda functions.
2525
// The regex will parse out the requestID and strip the timestamp
26-
// Example: 2016-11-10T23:11:54.523Z 108af3bb-a79b-11e6-8bd7-91c363cc05d9 some message
26+
// Example: 2016-11-10T23:11:54.523Z 108af3bb-a79b-11e6-8bd7-91c363cc05d9 some message
2727
var consoleFormatRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z\t(\w+?-\w+?-\w+?-\w+?-\w+)\t/;
2828

2929
// Used to extract RequestID
@@ -33,7 +33,6 @@ var https = require('https');
3333
var zlib = require('zlib');
3434
var url = require('url');
3535

36-
3736
Promise.retryMax = function(fn,retry,interval,fnParams) {
3837
return fn.apply(this,fnParams).catch( err => {
3938
var waitTime = typeof interval === 'function' ? interval() : interval;
@@ -106,7 +105,8 @@ function postToSumo(context, messages) {
106105
var options = {
107106
'hostname': urlObject.hostname,
108107
'path': urlObject.pathname,
109-
'method': 'POST'
108+
'method': 'POST',
109+
'port': urlObject.port
110110
};
111111

112112
var finalizeContext = function () {
@@ -248,7 +248,8 @@ exports.handler = function (event, context) {
248248
// Push messages to Sumo
249249
if (index === numOfRecords-1) {
250250
postToSumo(context, messageList);
251-
}
251+
}
252252

253253
});
254254
};
255+

0 commit comments

Comments
 (0)