We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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"""

{"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"}], "after_files": [{"content": "\"\"\"\nCopyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\nSPDX-License-Identifier: MIT-0\n\"\"\"\nimport json\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 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 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        return matches\n\n    def __get_log_group_name_list(self, cfn):\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 = 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        matches = []\n        matches.extend(\n            self.check_events_subscription_duplicated(cfn)\n        )\n        return matches\n", "path": "src/cfnlint/rules/resources/lmbd/EventsLogGroupName.py"}]}