prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  E2529 error with multiple `AWS::Logs::SubscriptionFilter` resources.
  *cfn-lint version: 0.38.0*
  
  *[`E2529`](https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/rules.md#E2529) error with multiple [`AWS::Logs::SubscriptionFilter`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html) resources.*
  
  I have a CloudFormation template (using AWS SAM) that has multiple SubscriptionFilters. These SubscriptionFilters have the same `LogGroupName`, which causes an `E2529` error despite these filters having separate FilterPatterns. The template passes the [`aws cloudformation validate-template`](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/validate-template.html) command.
  
  [`src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py`](https://github.com/aws-cloudformation/cfn-python-lint/blob/master/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py)
  
  ```
    MainFunctionLogGroup:
      Type: AWS::Logs::LogGroup
      Properties:
        RetentionInDays: 14
        LogGroupName: !Join ["", [/aws/lambda/, !Ref MainFunction]]
  
    MainFunctionLogFilter:
      Type: AWS::Logs::SubscriptionFilter
      Properties:
        DestinationArn: !Ref LogIngestionARN
        FilterPattern: "FilterPattern1"
        LogGroupName: !Ref MainFunctionLogGroup
  
    SecondaryLogFilter:
      Type: AWS::Logs::SubscriptionFilter
      Properties:
        DestinationArn: !Ref LogIngestionARN
        FilterPattern: "FilterPattern2"
        LogGroupName: !Ref MainFunctionLogGroup
  ```
  
  </issue>
  <code>
  [start of src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py]
  1 """
  2 Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3 SPDX-License-Identifier: MIT-0
  4 """
  5 from cfnlint.rules import CloudFormationLintRule
  6 from cfnlint.rules import RuleMatch
  7 
  8 
  9 class EventsLogGroupName(CloudFormationLintRule):
  10     """Check if the settings of multiple subscriptions are included for one LogGroup"""
  11     id = 'E2529'
  12     shortdesc = 'Check for duplicate Lambda events'
  13     description = 'Check if there are any duplicate log groups in the Lambda event trigger element.'
  14     source_url = 'https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#user-content-cloudwatchlogs'
  15     tags = ['resources', 'lambda']
  16 
  17     def check_events_subscription_duplicated(self, cfn):
  18         """Check if Lambda Events Subscription is duplicated"""
  19         matches = []
  20         message = 'You must specify the AWS::Serverless::Function event correctly. ' \
  21                   'LogGroups are duplicated. '
  22 
  23         log_group_name_list = self.__get_log_group_name_list(cfn)
  24 
  25         if self.__is_duplicated(log_group_name_list):
  26             matches.append(
  27                 RuleMatch(
  28                     'path', message.format()
  29                 )
  30             )
  31 
  32         return matches
  33 
  34     def __is_duplicated(self, duplicate_list):
  35         unique_list = self.__remove(duplicate_list)
  36         return len(unique_list) != len(duplicate_list)
  37 
  38     def __remove(self, duplicate):
  39         final_list = []
  40         for ele in duplicate:
  41             if ele not in final_list:
  42                 final_list.append(ele)
  43         return final_list
  44 
  45     def __get_log_group_name_list(self, cfn):
  46         log_group_name_list = []
  47         for value in cfn.get_resources('AWS::Logs::SubscriptionFilter').items():
  48             prop = value[1].get('Properties')
  49             log_group_name_list.append(prop.get('LogGroupName'))
  50         return log_group_name_list
  51 
  52     def match(self, cfn):
  53         """Check if Lambda Events Subscription is duplicated"""
  54         matches = []
  55         matches.extend(
  56             self.check_events_subscription_duplicated(cfn)
  57         )
  58         return matches
  59
  [end of src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py b/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py
  --- a/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py
  +++ b/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py
  @@ -2,6 +2,7 @@
   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   SPDX-License-Identifier: MIT-0
   """
  +import json
   from cfnlint.rules import CloudFormationLintRule
   from cfnlint.rules import RuleMatch
   
  @@ -9,45 +10,41 @@
   class EventsLogGroupName(CloudFormationLintRule):
       """Check if the settings of multiple subscriptions are included for one LogGroup"""
       id = 'E2529'
  -    shortdesc = 'Check for duplicate Lambda events'
  -    description = 'Check if there are any duplicate log groups in the Lambda event trigger element.'
  +    shortdesc = 'Check for SubscriptionFilters have beyond 2 attachments to a CloudWatch Log Group'
  +    description = 'The current limit for a CloudWatch Log Group is they can have 2 subscription filters. ' \
  +        'We will look for duplicate LogGroupNames inside Subscription Filters and make sure they are within 2. ' \
  +        'This doesn\'t account for any other subscription filters getting set.'
       source_url = 'https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#user-content-cloudwatchlogs'
       tags = ['resources', 'lambda']
  +    limit = 2
   
       def check_events_subscription_duplicated(self, cfn):
           """Check if Lambda Events Subscription is duplicated"""
           matches = []
  -        message = 'You must specify the AWS::Serverless::Function event correctly. ' \
  -                  'LogGroups are duplicated. '
  -
  -        log_group_name_list = self.__get_log_group_name_list(cfn)
  -
  -        if self.__is_duplicated(log_group_name_list):
  -            matches.append(
  -                RuleMatch(
  -                    'path', message.format()
  +        message = 'You can only have {} Subscription Filters per CloudWatch Log Group'.format(self.limit)
  +
  +        log_group_paths = self.__get_log_group_name_list(cfn)
  +        for _, c in log_group_paths.items():
  +            if len(c) > self.limit:
  +                matches.append(
  +                    RuleMatch(
  +                        ['Resources', c[2]], message.format()
  +                    )
                   )
  -            )
   
           return matches
   
  -    def __is_duplicated(self, duplicate_list):
  -        unique_list = self.__remove(duplicate_list)
  -        return len(unique_list) != len(duplicate_list)
  -
  -    def __remove(self, duplicate):
  -        final_list = []
  -        for ele in duplicate:
  -            if ele not in final_list:
  -                final_list.append(ele)
  -        return final_list
  -
       def __get_log_group_name_list(self, cfn):
  -        log_group_name_list = []
  +        log_group_paths = {}
           for value in cfn.get_resources('AWS::Logs::SubscriptionFilter').items():
               prop = value[1].get('Properties')
  -            log_group_name_list.append(prop.get('LogGroupName'))
  -        return log_group_name_list
  +            log_group_name = json.dumps(prop.get('LogGroupName'))
  +
  +            if log_group_name not in log_group_paths:
  +                log_group_paths[log_group_name] = []
  +
  +            log_group_paths[log_group_name].append(value[0])
  +        return log_group_paths
   
       def match(self, cfn):
           """Check if Lambda Events Subscription is duplicated"""
  
verification_info: {"golden_diff": "diff --git a/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py b/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py\n--- a/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py\n+++ b/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py\n@@ -2,6 +2,7 @@\n Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n SPDX-License-Identifier: MIT-0\n \"\"\"\n+import json\n from cfnlint.rules import CloudFormationLintRule\n from cfnlint.rules import RuleMatch\n \n@@ -9,45 +10,41 @@\n class EventsLogGroupName(CloudFormationLintRule):\n     \"\"\"Check if the settings of multiple subscriptions are included for one LogGroup\"\"\"\n     id = 'E2529'\n-    shortdesc = 'Check for duplicate Lambda events'\n-    description = 'Check if there are any duplicate log groups in the Lambda event trigger element.'\n+    shortdesc = 'Check for SubscriptionFilters have beyond 2 attachments to a CloudWatch Log Group'\n+    description = 'The current limit for a CloudWatch Log Group is they can have 2 subscription filters. ' \\\n+        'We will look for duplicate LogGroupNames inside Subscription Filters and make sure they are within 2. ' \\\n+        'This doesn\\'t account for any other subscription filters getting set.'\n     source_url = 'https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#user-content-cloudwatchlogs'\n     tags = ['resources', 'lambda']\n+    limit = 2\n \n     def check_events_subscription_duplicated(self, cfn):\n         \"\"\"Check if Lambda Events Subscription is duplicated\"\"\"\n         matches = []\n-        message = 'You must specify the AWS::Serverless::Function event correctly. ' \\\n-                  'LogGroups are duplicated. '\n-\n-        log_group_name_list = self.__get_log_group_name_list(cfn)\n-\n-        if self.__is_duplicated(log_group_name_list):\n-            matches.append(\n-                RuleMatch(\n-                    'path', message.format()\n+        message = 'You can only have {} Subscription Filters per CloudWatch Log Group'.format(self.limit)\n+\n+        log_group_paths = self.__get_log_group_name_list(cfn)\n+        for _, c in log_group_paths.items():\n+            if len(c) > self.limit:\n+                matches.append(\n+                    RuleMatch(\n+                        ['Resources', c[2]], message.format()\n+                    )\n                 )\n-            )\n \n         return matches\n \n-    def __is_duplicated(self, duplicate_list):\n-        unique_list = self.__remove(duplicate_list)\n-        return len(unique_list) != len(duplicate_list)\n-\n-    def __remove(self, duplicate):\n-        final_list = []\n-        for ele in duplicate:\n-            if ele not in final_list:\n-                final_list.append(ele)\n-        return final_list\n-\n     def __get_log_group_name_list(self, cfn):\n-        log_group_name_list = []\n+        log_group_paths = {}\n         for value in cfn.get_resources('AWS::Logs::SubscriptionFilter').items():\n             prop = value[1].get('Properties')\n-            log_group_name_list.append(prop.get('LogGroupName'))\n-        return log_group_name_list\n+            log_group_name = json.dumps(prop.get('LogGroupName'))\n+\n+            if log_group_name not in log_group_paths:\n+                log_group_paths[log_group_name] = []\n+\n+            log_group_paths[log_group_name].append(value[0])\n+        return log_group_paths\n \n     def match(self, cfn):\n         \"\"\"Check if Lambda Events Subscription is duplicated\"\"\"\n", "issue": "E2529 error with multiple `AWS::Logs::SubscriptionFilter` resources.\n*cfn-lint version: 0.38.0*\r\n\r\n*[`E2529`](https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/rules.md#E2529) error with multiple [`AWS::Logs::SubscriptionFilter`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html) resources.*\r\n\r\nI have a CloudFormation template (using AWS SAM) that has multiple SubscriptionFilters. These SubscriptionFilters have the same `LogGroupName`, which causes an `E2529` error despite these filters having separate FilterPatterns. The template passes the [`aws cloudformation validate-template`](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/validate-template.html) command.\r\n\r\n[`src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py`](https://github.com/aws-cloudformation/cfn-python-lint/blob/master/src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py)\r\n\r\n```\r\n  MainFunctionLogGroup:\r\n    Type: AWS::Logs::LogGroup\r\n    Properties:\r\n      RetentionInDays: 14\r\n      LogGroupName: !Join [\"\", [/aws/lambda/, !Ref MainFunction]]\r\n\r\n  MainFunctionLogFilter:\r\n    Type: AWS::Logs::SubscriptionFilter\r\n    Properties:\r\n      DestinationArn: !Ref LogIngestionARN\r\n      FilterPattern: \"FilterPattern1\"\r\n      LogGroupName: !Ref MainFunctionLogGroup\r\n\r\n  SecondaryLogFilter:\r\n    Type: AWS::Logs::SubscriptionFilter\r\n    Properties:\r\n      DestinationArn: !Ref LogIngestionARN\r\n      FilterPattern: \"FilterPattern2\"\r\n      LogGroupName: !Ref MainFunctionLogGroup\r\n```\n", "before_files": [{"content": "\"\"\"\nCopyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\nSPDX-License-Identifier: MIT-0\n\"\"\"\nfrom cfnlint.rules import CloudFormationLintRule\nfrom cfnlint.rules import RuleMatch\n\n\nclass EventsLogGroupName(CloudFormationLintRule):\n    \"\"\"Check if the settings of multiple subscriptions are included for one LogGroup\"\"\"\n    id = 'E2529'\n    shortdesc = 'Check for duplicate Lambda events'\n    description = 'Check if there are any duplicate log groups in the Lambda event trigger element.'\n    source_url = 'https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#user-content-cloudwatchlogs'\n    tags = ['resources', 'lambda']\n\n    def check_events_subscription_duplicated(self, cfn):\n        \"\"\"Check if Lambda Events Subscription is duplicated\"\"\"\n        matches = []\n        message = 'You must specify the AWS::Serverless::Function event correctly. ' \\\n                  'LogGroups are duplicated. '\n\n        log_group_name_list = self.__get_log_group_name_list(cfn)\n\n        if self.__is_duplicated(log_group_name_list):\n            matches.append(\n                RuleMatch(\n                    'path', message.format()\n                )\n            )\n\n        return matches\n\n    def __is_duplicated(self, duplicate_list):\n        unique_list = self.__remove(duplicate_list)\n        return len(unique_list) != len(duplicate_list)\n\n    def __remove(self, duplicate):\n        final_list = []\n        for ele in duplicate:\n            if ele not in final_list:\n                final_list.append(ele)\n        return final_list\n\n    def __get_log_group_name_list(self, cfn):\n        log_group_name_list = []\n        for value in cfn.get_resources('AWS::Logs::SubscriptionFilter').items():\n            prop = value[1].get('Properties')\n            log_group_name_list.append(prop.get('LogGroupName'))\n        return log_group_name_list\n\n    def match(self, cfn):\n        \"\"\"Check if Lambda Events Subscription is duplicated\"\"\"\n        matches = []\n        matches.extend(\n            self.check_events_subscription_duplicated(cfn)\n        )\n        return matches\n", "path": "src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py"}]}