Logs put_subscription_filter call fails with "Service 'logs' has not implemented for put_subscription_filter()"
Hey All, I'm trying to mock the aws.logs behavior of creating a log group -> adding a subscription filter to log group.
I believe I've got everything set up correctly (based off the documentation) and I'm getting this error, and I've validated that the put_subscription_filter() method is indeed IMPLEMENTED for the logs service. I'm also using the latest versions of boto3 and moto
Here's the test Ive been using:
@mock_aws
def test_get_filters(aws_credentials):
"""
This test mocks the behavior of getting subscriptions from a log group
"""
log_group_name = '/test'
log_stream_name = 'stream'
filter_name = f"{log_group_name}"
logs_client = boto3.client("logs", "us-east-1")
logs_client.create_log_group(logGroupName=log_group_name)
logs_client.create_log_stream(
logGroupName=log_group_name, logStreamName=log_stream_name
)
logs_client.put_subscription_filter(
logGroupName=log_group_name,
filterName="test",
filterPattern="[]",
destinationArn="arn:aws:logs:us-east-1:123456789012:destination:test",
)
response = logs_client.describe_subscription_filters(logGroupName=log_group_name)
assert len(response["subscriptionFilters"]) == 1
Replication steps
Use @mock_aws on a test function: create a log client, create a log group with create_log_group(), then try and put a subscription using put_subscription_filter().
Took a look at previous issues (specifically https://github.com/getmoto/moto/issues/6126), Looks like this is an issue with logs destination ARN's not being supported?
Hi @apemonke, welcome to Moto! The error message is a bit confusing, but yes, you're right - it's not yet supported for log destination ARN's.
I'll mark it as an enhancement.
Thanks @bblommers !!