Skip to content

Commit

Permalink
Merge pull request #71 from daniel-greening/add_application_id
Browse files Browse the repository at this point in the history
Add application Id to templates and log messages
  • Loading branch information
Aaron O'Hagan authored Mar 3, 2020
2 parents 538bb86 + 20c8f06 commit 9a2d156
Show file tree
Hide file tree
Showing 29 changed files with 95 additions and 7,874 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ test/ide_test.js
**/report.xml
**.swp
**.swo

*.DS_Store
8 changes: 8 additions & 0 deletions cfn/paws-collector.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"Type": "String",
"NoEcho": true
},
"AlApplicationId": {
"Description": "Alert Logic Application Id for collector logs",
"Type": "String"
"Default": "paws"
},
"AlApiEndpoint": {
"Description": "Alert Logic API endpoint",
"Type": "String",
Expand Down Expand Up @@ -550,6 +555,9 @@
{ "Ref" : "PawsCollectorTypeName" },
"-collector.json"
]]},
"al_application_id":{
"Ref":"AlApplicationId"
},
"al_api":{
"Ref":"AlApiEndpoint"
},
Expand Down
5 changes: 4 additions & 1 deletion collectors/auth0/auth0_collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class Auth0Collector extends PawsCollector {
}

pawsFormatLog(msg) {
let collector = this;

const ts = parse.getMsgTs(msg, tsPaths);
const typeId = parse.getMsgTypeId(msg, typeIdPaths);

Expand All @@ -84,7 +86,8 @@ class Auth0Collector extends PawsCollector {
priority: 11,
progName: 'Auth0Collector',
message: JSON.stringify(msg),
messageType: 'json/auth0'
messageType: 'json/auth0',
application_id: collector.application_id
};

if (typeId !== null && typeId !== undefined) {
Expand Down
6 changes: 6 additions & 0 deletions collectors/auth0/cfn/auth0-collector.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"api.global-integration.product.dev.alertlogic.com"
]
},
"AlApplicationId": {
"Description": "Alert Logic Application Id for collector logs",
"Type": "String",
"Default": "auth0"
},
"AlDataResidency": {
"Description": "Alert Logic Data Residency",
"Type": "String",
Expand Down Expand Up @@ -75,6 +80,7 @@
"Parameters" : {
"AlertlogicAccessKeyId" : { "Ref":"AlertlogicAccessKeyId" },
"AlertlogicSecretKey" : { "Ref":"AlertlogicSecretKey" },
"AlApplicationId" : { "Ref":"AlApplicationId" },
"AlApiEndpoint" : { "Ref":"AlApiEndpoint" },
"AlDataResidency" : { "Ref":"AlDataResidency" },
"PackagesBucketPrefix" : { "Ref":"PackagesBucketPrefix" },
Expand Down
4 changes: 2 additions & 2 deletions collectors/auth0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
"dependencies": {
"auth0": "2.20.0",
"@alertlogic/al-collector-js": "1.4.2",
"@alertlogic/paws-collector": "1.0.15",
"@alertlogic/al-collector-js": "^1.4.2",
"@alertlogic/paws-collector": "^1.1.0",
"async": "3.1.0",
"debug": "4.1.1",
"moment": "2.24.0"
Expand Down
1 change: 1 addition & 0 deletions collectors/auth0/test/auth0_mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ process.env.paws_api_secret = 'auth0-token';
process.env.collector_id = 'collector-id';
process.env.paws_poll_interval = 60;
process.env.paws_secret_param_name = 'PAWS-SECRET-auth0';
process.env.al_application_id = 'auth0';

const AIMS_TEST_CREDS = {
access_key_id: 'test-access-key-id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"Type": "String",
"NoEcho": true
},
"AlApplicationId": {
"Description": "Alert Logic Application Id for collector logs",
"Type": "String",
"Default": "googlestackdriver"
},
"AlApiEndpoint": {
"Description": "Alert Logic API endpoint",
"Type": "String",
Expand Down Expand Up @@ -82,6 +87,9 @@
"AlertlogicSecretKey": {
"Ref": "AlertlogicSecretKey"
},
"AlApplicationId": {
"Ref": "AlApplicationId"
},
"AlApiEndpoint": {
"Ref": "AlApiEndpoint"
},
Expand Down
6 changes: 5 additions & 1 deletion collectors/googlestackdriver/collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ timestamp < "${state.until}"`;

// TODO: probably need to actually decode hte protobuf payload on these logs
pawsFormatLog(msg) {
let collector = this;

const ts = msg.timestamp ? msg.timestamp : {seconds: Date.now() / 1000};

const typeId = parse.getMsgTypeId(msg, typeIdPaths);
Expand All @@ -149,7 +151,9 @@ timestamp < "${state.until}"`;
priority: 11,
progName: 'GooglestackdriverCollector',
message: JSON.stringify(msg),
messageType: 'json/googlestackdriver'
messageType: 'json/googlestackdriver',
application_id: collector.application_id

};

if (typeId !== null && typeId !== undefined) {
Expand Down
Loading

0 comments on commit 9a2d156

Please sign in to comment.