Example #1
0
 def test_dms_event(self):
     self.assertEqual(
         parse_event_source({"awslogs": "logs"}, "dms-tasks-test-instance"),
         "dms")
     self.assertEqual(
         parse_event_source({"Records": ["logs-from-s3"]},
                            "AWSLogs/amazon_dms/my-s3.json.gz"),
         "dms",
     )
Example #2
0
 def test_docdb_event(self):
     self.assertEqual(
         parse_event_source({"awslogs": "logs"},
                            "/aws/docdb/testCluster/profile"),
         "docdb",
     )
     self.assertEqual(
         parse_event_source({"Records": ["logs-from-s3"]},
                            "/amazon_documentdb/dev/123abc.zip"),
         "docdb",
     )
Example #3
0
 def test_vpc_event(self):
     self.assertEqual(
         parse_event_source({"awslogs": "logs"}, "abc123_my_vpc_loggroup"),
         "vpc")
     self.assertEqual(
         parse_event_source(
             {"Records": ["logs-from-s3"]},
             "AWSLogs/123456779121/vpcflowlogs/us-east-1/2020/10/02/123456779121_vpcflowlogs_us-east-1_fl-xxxxx.log.gz",
         ),
         "vpc",
     )
Example #4
0
 def test_kinesis_event(self):
     self.assertEqual(
         parse_event_source({"awslogs": "logs"},
                            "/aws/kinesisfirehose/test"),
         "kinesis",
     )
     self.assertEqual(
         parse_event_source({"Records": ["logs-from-s3"]},
                            "AWSLogs/amazon_kinesis/my-s3.json.gz"),
         "kinesis",
     )
Example #5
0
 def test_msk_event(self):
     self.assertEqual(
         parse_event_source(
             {"awslogs": "logs"},
             "/myMSKLogGroup",
         ),
         "msk",
     )
     self.assertEqual(
         parse_event_source(
             {"Records": ["logs-from-s3"]},
             "AWSLogs/amazon_msk/us-east-1/xxxxx.log.gz",
         ),
         "msk",
     )
Example #6
0
 def test_sns_event(self):
     self.assertEqual(
         parse_event_source(
             {"awslogs": "logs"}, "sns/us-east-1/123456779121/SnsTopicX"
         ),
         "sns",
     )
Example #7
0
 def test_codebuild_event(self):
     self.assertEqual(
         parse_event_source(
             {"awslogs": "logs"}, "/aws/codebuild/new-project-sample"
         ),
         "codebuild",
     )
Example #8
0
 def test_apigateway_event(self):
     self.assertEqual(
         parse_event_source(
             {"awslogs": "logs"}, "Api-Gateway-Execution-Logs_a1b23c/test"
         ),
         "apigateway",
     )
Example #9
0
 def test_eks_event(self):
     self.assertEqual(
         parse_event_source(
             {"awslogs": "logs"},
             "/aws/eks/control-plane/cluster",
         ),
         "eks",
     )
Example #10
0
 def test_cloudfront_event(self):
     self.assertEqual(
         parse_event_source(
             {"Records": ["logs-from-s3"]},
             "AWSLogs/cloudfront/123456779121/test/01.gz",
         ),
         "cloudfront",
     )
Example #11
0
 def test_fargate_event(self):
     self.assertEqual(
         parse_event_source(
             {"awslogs": "logs"},
             "/ecs/fargate-logs",
         ),
         "fargate",
     )
Example #12
0
 def test_route53_event(self):
     self.assertEqual(
         parse_event_source(
             {"awslogs": "logs"},
             "my-route53-loggroup123",
         ),
         "route53",
     )
Example #13
0
 def test_redshift_event(self):
     self.assertEqual(
         parse_event_source(
             {"Records": ["logs-from-s3"]},
             "AWSLogs/123456779121/redshift/us-east-1/2020/10/21/123456779121_redshift_us-east-1_mycluster_userlog_2020-10-21T18:01.gz",
         ),
         "redshift",
     )
Example #14
0
 def test_waf_event(self):
     self.assertEqual(
         parse_event_source(
             {"Records": ["logs-from-s3"]},
             "2020/10/02/21/aws-waf-logs-testing-1-2020-10-02-21-25-30-x123x-x456x",
         ),
         "waf",
     )
Example #15
0
 def test_elb_event(self):
     self.assertEqual(
         parse_event_source(
             {"Records": ["logs-from-s3"]},
             "AWSLogs/123456779121/elasticloadbalancing/us-east-1/2020/10/02/123456779121_elasticloadbalancing_us-east-1_app.alb.xxxxx.xx.xxx.xxx_x.log.gz",
         ),
         "elb",
     )
Example #16
0
 def test_cloudtrail_event(self):
     self.assertEqual(
         parse_event_source(
             {"Records": ["logs-from-s3"]},
             "cloud-trail/AWSLogs/123456779121/CloudTrail/us-west-3/2018/01/07/123456779121_CloudTrail_eu-west-3_20180707T1735Z_abcdefghi0MCRL2O.json.gz",
         ),
         "cloudtrail",
     )
Example #17
0
 def test_cloudtrail_event_with_service_substrings(self):
     # Assert that source "cloudtrail" is parsed even though substrings "waf" and "sns" are present in the key
     self.assertEqual(
         parse_event_source(
             {"Records": ["logs-from-s3"]},
             "cloud-trail/AWSLogs/123456779121/CloudTrail/us-west-3/2018/01/07/123456779121_CloudTrail_eu-west-3_20180707T1735Z_xywafKsnsXMBrdsMCRL2O.json.gz",
         ),
         "cloudtrail",
     )
Example #18
0
 def test_cloudwatch_source_if_none_found(self):
     self.assertEqual(parse_event_source({"awslogs": "logs"}, ""),
                      "cloudwatch")
Example #19
0
 def test_aws_source_if_none_found(self):
     self.assertEqual(parse_event_source({}, "asdfalsfhalskjdfhalsjdf"),
                      "aws")
Example #20
0
 def test_lambda_event(self):
     self.assertEqual(
         parse_event_source({"awslogs": "logs"}, "/aws/lambda/postRestAPI"),
         "lambda")
Example #21
0
 def test_mysql_event(self):
     self.assertEqual(
         parse_event_source({"awslogs": "logs"},
                            "/aws/rds/mySQL-instance/error"),
         "mysql",
     )
Example #22
0
 def test_mariadb_event(self):
     self.assertEqual(
         parse_event_source({"awslogs": "logs"},
                            "/aws/rds/mariaDB-instance/error"),
         "mariadb",
     )
Example #23
0
 def test_rds_event(self):
     self.assertEqual(
         parse_event_source({"awslogs": "logs"},
                            "/aws/rds/my-rds-resource"), "rds")
Example #24
0
 def test_s3_source_if_none_found(self):
     self.assertEqual(parse_event_source({"Records": ["logs-from-s3"]}, ""),
                      "s3")