Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b15d6b6
adding fields update to HTTP Source. For FER, passing FER ID.
Jun 15, 2020
67b3757
adding sleep for import API.
Jun 16, 2020
c18a501
adding scaninterval as part of parameters.
Jun 23, 2020
61c8fd4
Merge branch 'master' into sourabh-aws-observability
Jun 23, 2020
f3e5be8
converting value to int.
Jun 23, 2020
b6eca6c
adding class to add fields to hsot metrics sources.
Jun 26, 2020
a5e5b6c
making instance Ids to 10.
Jun 26, 2020
07e0b1d
Merge branch 'master' into sourabh-aws-observability
Jun 26, 2020
d7ddc48
remove if condition.
Jun 26, 2020
036a671
bumping version for auto enable.
Jun 29, 2020
246ef8a
adding API for Field Management.
Jun 30, 2020
6d2e190
defaulting cutoff time stamp to 24 hours
Jul 17, 2020
7f8b925
instead of returning boolean, returning Yes and No.
Jul 17, 2020
d468e83
instead of returning boolean, returning Yes and No.
Jul 17, 2020
7a00ee5
instead of returning boolean, returning Yes and No.
Jul 17, 2020
b2d97a1
adding policy for network load balancer.
Jul 20, 2020
56944ed
releasing new version of sumologic-app-utils, s3 auto enable function.
Jul 20, 2020
b1c87ba
improving duplicate logic for Explorer view, Metric Rules and Fields.
Jul 21, 2020
afea4a1
handling exception during delete, as update can fail if the previous …
Jul 23, 2020
f7bd08f
adding condition to handle XRAY source.
Aug 4, 2020
e63b343
Converting mode to debug to stop printing Access Keys
Aug 24, 2020
300dbf6
Merge branch 'master' into sourabh-aws-observability
Aug 24, 2020
93fdc20
Merge branch 'master' into sourabh-aws-observability
Aug 27, 2020
ec43f15
publishing 2.0.3 version of the SumoLogic-app-utils function.
Aug 28, 2020
39788f9
changing Name.
Aug 28, 2020
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
57 changes: 15 additions & 42 deletions awsautoenableS3Logging/packaged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Metadata:
- s3logging
- flowlogs
Name: sumologic-s3-logging-auto-enable
SemanticVersion: 1.0.0
SemanticVersion: 1.0.2
SourceCodeUrl: https://github.com/SumoLogic/sumologic-aws-lambda/tree/master/awsautoenableS3Logging
LicenseUrl: s3://appdevstore/AutoEnableS3Logs/v1.0.0/978602b5b9ec16f8bab0e38fd6b3998f
ReadmeUrl: s3://appdevstore/AutoEnableS3Logs/v1.0.0/d05d411471e0bb4db3389f2523f515f0
LicenseUrl: s3://appdevstore/AutoEnableS3Logs/v1.0.2/978602b5b9ec16f8bab0e38fd6b3998f
ReadmeUrl: s3://appdevstore/AutoEnableS3Logs/v1.0.2/d05d411471e0bb4db3389f2523f515f0
SpdxLicenseId: Apache-2.0
Mappings:
Region2ELBAccountId:
Expand Down Expand Up @@ -92,7 +92,7 @@ Parameters:
- S3
- VPC
- ALB
AutoTaggingResourceOptions:
AutoEnableResourceOptions:
Type: String
Description: New - Automatically enables S3 logging for newly created AWS resources
to send logs to S3 Buckets. This does not affect AWS resources already collecting
Expand Down Expand Up @@ -129,10 +129,6 @@ Parameters:
Description: True - To remove S3 logging or Vpc flow logs. False - To keep the
S3 logging.
Type: String
ParentStackName:
Type: String
Default: ParentStackName
Description: Parent Stack Name. Do Not Edit the value.
Conditions:
enable_alb_logging:
Fn::And:
Expand All @@ -155,25 +151,19 @@ Conditions:
auto_enable_existing:
Fn::Or:
- Fn::Equals:
- Ref: AutoTaggingResourceOptions
- Ref: AutoEnableResourceOptions
- Existing
- Fn::Equals:
- Ref: AutoTaggingResourceOptions
- Ref: AutoEnableResourceOptions
- Both
auto_enable_new:
Fn::Or:
- Fn::Equals:
- Ref: AutoTaggingResourceOptions
- Ref: AutoEnableResourceOptions
- New
- Fn::Equals:
- Ref: AutoTaggingResourceOptions
- Ref: AutoEnableResourceOptions
- Both
do_not_use_parent_stack:
Fn::And:
- Fn::Equals:
- Ref: ParentStackName
- ParentStackName
- Condition: auto_enable_existing
Resources:
SumoLambdaRole:
Type: AWS::IAM::Role
Expand Down Expand Up @@ -223,20 +213,7 @@ Resources:
Type: AWS::Serverless::Function
Condition: auto_enable_new
Properties:
FunctionName:
Fn::Join:
- ''
- - sumo-s3-enable-
- Fn::Select:
- 0
- Fn::Split:
- '-'
- Fn::Select:
- 2
- Fn::Split:
- /
- Ref: AWS::StackId
CodeUri: s3://appdevstore/sumo_app_utils/v2.0.0/sumo_app_utils.zip
CodeUri: s3://appdevstore/sumo_app_utils/v2.0.2/sumo_app_utils.zip
Handler: awsresource.enable_s3_logs
Runtime: python3.7
Role:
Expand Down Expand Up @@ -404,11 +381,11 @@ Resources:
Id: Main
EnableExisitngAWSResourcesLambda:
Type: AWS::Serverless::Function
Condition: do_not_use_parent_stack
Condition: auto_enable_existing
Properties:
Handler: main.handler
Runtime: python3.7
CodeUri: s3://appdevstore/sumo_app_utils/v2.0.0/sumo_app_utils.zip
CodeUri: s3://appdevstore/sumo_app_utils/v2.0.2/sumo_app_utils.zip
MemorySize: 128
Timeout: 900
Role:
Expand All @@ -420,13 +397,9 @@ Resources:
Condition: auto_enable_existing
Properties:
ServiceToken:
Fn::If:
- do_not_use_parent_stack
- Fn::GetAtt:
- EnableExisitngAWSResourcesLambda
- Arn
- Fn::ImportValue:
Fn::Sub: ${ParentStackName}-SumoLogicHelperFunctionARN
Fn::GetAtt:
- EnableExisitngAWSResourcesLambda
- Arn
AWSResource:
Fn::If:
- enable_s3_buckets_logging
Expand Down Expand Up @@ -464,4 +437,4 @@ Outputs:
Fn::GetAtt:
- EnableExisitngAWSResourcesLambda
- Arn
Condition: do_not_use_parent_stack
Condition: auto_enable_existing
47 changes: 11 additions & 36 deletions awsautoenableS3Logging/sumologic-s3-logging-auto-enable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Metadata:
- s3logging
- flowlogs
Name: sumologic-s3-logging-auto-enable
SemanticVersion: 1.0.0
SemanticVersion: 1.0.2
SourceCodeUrl: https://github.com/SumoLogic/sumologic-aws-lambda/tree/master/awsautoenableS3Logging
LicenseUrl: ./LICENSE
ReadmeUrl: ./README.md
Expand Down Expand Up @@ -95,7 +95,7 @@ Parameters:
- 'VPC'
- 'ALB'

AutoTaggingResourceOptions:
AutoEnableResourceOptions:
Type: String
Description: "New - Automatically enables S3 logging for newly created AWS resources to send logs to S3 Buckets. This does not affect AWS resources already collecting logs.
Existing - Automatically enables S3 logging for existing AWS resources to send logs to S3 Buckets.
Expand Down Expand Up @@ -132,11 +132,6 @@ Parameters:
False - To keep the S3 logging."
Type: String

ParentStackName:
Type: String
Default: "ParentStackName"
Description: Parent Stack Name. Do Not Edit the value.

Conditions:
enable_alb_logging: !And
- !Equals [!Ref AutoEnableLogging, 'ALB']
Expand All @@ -149,15 +144,11 @@ Conditions:
- !Condition auto_enable_new

auto_enable_existing: !Or
- !Equals [ !Ref AutoTaggingResourceOptions, 'Existing' ]
- !Equals [ !Ref AutoTaggingResourceOptions, 'Both' ]
- !Equals [ !Ref AutoEnableResourceOptions, 'Existing' ]
- !Equals [ !Ref AutoEnableResourceOptions, 'Both' ]
auto_enable_new: !Or
- !Equals [ !Ref AutoTaggingResourceOptions, 'New' ]
- !Equals [ !Ref AutoTaggingResourceOptions, 'Both' ]

do_not_use_parent_stack: !And
- !Equals [ !Ref ParentStackName, "ParentStackName"]
- !Condition auto_enable_existing
- !Equals [ !Ref AutoEnableResourceOptions, 'New' ]
- !Equals [ !Ref AutoEnableResourceOptions, 'Both' ]

Resources:

Expand Down Expand Up @@ -210,17 +201,7 @@ Resources:
Type: 'AWS::Serverless::Function'
Condition: auto_enable_new
Properties:
FunctionName: !Join
- ""
- - "sumo-s3-enable-"
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split ["/", !Ref "AWS::StackId"]
CodeUri: s3://appdevstore/sumo_app_utils/v2.0.0/sumo_app_utils.zip
CodeUri: s3://appdevstore/sumo_app_utils/v2.0.2/sumo_app_utils.zip
Handler: "awsresource.enable_s3_logs"
Runtime: python3.7
Role: !GetAtt SumoLambdaRole.Arn
Expand Down Expand Up @@ -354,11 +335,11 @@ Resources:

EnableExisitngAWSResourcesLambda:
Type: 'AWS::Serverless::Function'
Condition: do_not_use_parent_stack
Condition: auto_enable_existing
Properties:
Handler: main.handler
Runtime: python3.7
CodeUri: s3://appdevstore/sumo_app_utils/v2.0.0/sumo_app_utils.zip
CodeUri: s3://appdevstore/sumo_app_utils/v2.0.2/sumo_app_utils.zip
MemorySize: 128
Timeout: 900
Role:
Expand All @@ -370,13 +351,7 @@ Resources:
Type: Custom::EnableS3LogsResources
Condition: auto_enable_existing
Properties:
ServiceToken: !If
- do_not_use_parent_stack
- !GetAtt
- EnableExisitngAWSResourcesLambda
- Arn
- !ImportValue
'Fn::Sub': '${ParentStackName}-SumoLogicHelperFunctionARN'
ServiceToken: !GetAtt EnableExisitngAWSResourcesLambda.Arn
AWSResource: !If [enable_s3_buckets_logging, "s3", !If [enable_vpc_flow_logs_logging, "vpc", "elbv2"] ]
BucketName: !Ref BucketName
Filter: !Ref FilterExpression
Expand All @@ -395,4 +370,4 @@ Outputs:
EnableExisitngAWSResourcesLambda:
Description: "Lambda Function ARN for Existing AWS Resources"
Value: !GetAtt EnableExisitngAWSResourcesLambda.Arn
Condition: do_not_use_parent_stack
Condition: auto_enable_existing
47 changes: 29 additions & 18 deletions awsautoenableS3Logging/test/TestTemplate.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/sh

export AWS_REGION="ap-south-1"
export AWS_REGION="us-east-1"
export AWS_PROFILE="personal"
# App to test
export AppName="tag"
export InstallTypes=("s3" "s3exiting" "vpc" "vpcexisting" "alb" "albexisting")
export InstallTypes=("s3both" "vpcboth" "albboth")

export BucketName="sumologiclambdahelper-${AWS_REGION}"
export FilterExpression=".*"
Expand All @@ -15,41 +15,52 @@ do

if [[ "${InstallType}" == "s3" ]]
then
export EnableLogging="S3"
export TaggingResourceOptions="New"
export AutoEnableLogging="S3"
export AutoEnableResourceOptions="New"
elif [[ "${InstallType}" == "s3exiting" ]]
then
export EnableLogging="S3"
export TaggingResourceOptions="Existing"
export AutoEnableLogging="S3"
export AutoEnableResourceOptions="Existing"
elif [[ "${InstallType}" == "s3both" ]]
then
export AutoEnableLogging="S3"
export AutoEnableResourceOptions="Both"
elif [[ "${InstallType}" == "vpc" ]]
then
export EnableLogging="VPC"
export TaggingResourceOptions="New"
export AutoEnableLogging="VPC"
export AutoEnableResourceOptions="New"
elif [[ "${InstallType}" == "vpcexisting" ]]
then
export EnableLogging="VPC"
export TaggingResourceOptions="Existing"
export AutoEnableLogging="VPC"
export AutoEnableResourceOptions="Existing"
elif [[ "${InstallType}" == "vpcboth" ]]
then
export AutoEnableLogging="VPC"
export AutoEnableResourceOptions="Both"
elif [[ "${InstallType}" == "alb" ]]
then
export EnableLogging="ALB"
export TaggingResourceOptions="New"
export AutoEnableLogging="ALB"
export AutoEnableResourceOptions="New"
elif [[ "${InstallType}" == "albexisting" ]]
then
export EnableLogging="ALB"
export TaggingResourceOptions="Existing"
export AutoEnableLogging="ALB"
export AutoEnableResourceOptions="Existing"
export BucketPrefix=${InstallType}"-LOGS"
elif [[ "${InstallType}" == "albboth" ]]
then
export AutoEnableLogging="ALB"
export AutoEnableResourceOptions="Both"
export BucketPrefix=${InstallType}"-BOTH"
else
echo "No Valid Choice."
fi

# Stack Name
export stackName="${AppName}-${InstallType}"

aws cloudformation deploy --region ${AWS_REGION} --profile ${AWS_PROFILE} --template-file ././../auto_enable_s3_alb.template.yaml \
aws cloudformation deploy --region ${AWS_REGION} --profile ${AWS_PROFILE} --template-file ./../sumologic-s3-logging-auto-enable.yaml \
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM --stack-name "${AppName}-${InstallType}" \
--parameter-overrides EnableLogging="${EnableLogging}" TaggingResourceOptions="${TaggingResourceOptions}" \
--parameter-overrides AutoEnableLogging="${AutoEnableLogging}" AutoEnableResourceOptions="${AutoEnableResourceOptions}" \
FilterExpression="${FilterExpression}" BucketName="${BucketName}" BucketPrefix="${BucketPrefix}" &

export ExistingResource="No"

done
Loading