Repository navigation
Description
Summary
Three of the four CloudWatch Logs read operations put PascalCase member names on the wire, where the CloudWatch Logs API (JSON 1.1) uses camelCase. botocore matches response members case-sensitively against the service model, so every field fails to match and the caller receives a list of empty dicts — with no error and an HTTP 200.
FilterLogEvents is correct. That makes this an inconsistency inside one plugin rather than a missing feature, which is what makes it easy to miss: a smoke test that happens to use filter_log_events passes.
Verified against ghcr.io/scttfrdmn/substrate:0.87.1, botocore 1.42.59.
What the caller sees
logs.describe_log_groups(logGroupNamePrefix=G)["logGroups"] # -> [{}]
logs.describe_log_streams(logGroupName=G)["logStreams"] # -> [{}]
logs.get_log_events(logGroupName=G, logStreamName="s1")["events"] # -> [{}]
logs.filter_log_events(logGroupName=G)["events"] # -> correct, fully populatedThe group genuinely exists and the count is right — one element per resource. Only the members vanish. So len() assertions pass while every field read raises KeyError.
Raw wire
DescribeLogGroups — should be logGroupName, arn, creationTime, retentionInDays:
{"logGroups":[{"LogGroupName":"/probe/logs-case-2","ARN":"arn:aws:logs:us-east-1:000000000000:log-group:/probe/logs-case-2","CreationTime":1785729605486}]}DescribeLogStreams — should be logStreamName, arn, creationTime, lastIngestionTime, uploadSequenceToken:
{"logStreams":[{"LogStreamName":"s1","ARN":"arn:aws:logs:us-east-1:000000000000:log-group:/probe/logs-case-2:log-stream:s1","CreationTime":1785729605488,"LastIngestionTime":1785729605489,"UploadSequenceToken":"0bc22927-..."}]}GetLogEvents — should be timestamp, message, ingestionTime:
{"events":[{"Timestamp":1785728276850,"Message":"hello","IngestionTime":1785729605489}]}FilterLogEvents — correct, for contrast, including the nested searchedLogStreams:
{"events":[{"logStreamName":"s1","timestamp":1785728276850,"message":"hello","ingestionTime":1785729605489,"eventId":"000000000000-s1-0"}],"searchedLogStreams":[{"logStreamName":"s1","searchedCompletely":true}]}Note the outer keys are already right in all four (logGroups, logStreams, events) — it is only the element members that are PascalCase. That asymmetry suggests the element structs are serialised with default Go field names while the envelopes carry explicit JSON tags.
Reproducer
Requires only a running substrate; creates its own group.
import boto3
s = boto3.Session(aws_access_key_id="test", aws_secret_access_key="test", region_name="us-east-1")
logs = s.client("logs", endpoint_url="http://localhost:4566")
G = "/probe/logs-case" # use a fresh name per run; state is per-process
logs.create_log_group(logGroupName=G)
logs.create_log_stream(logGroupName=G, logStreamName="s1")
logs.put_log_events(logGroupName=G, logStreamName="s1",
logEvents=[{"timestamp": 1785728276850, "message": "hello"}])
assert logs.describe_log_groups(logGroupNamePrefix=G)["logGroups"] == [{}] # bug
assert logs.filter_log_events(logGroupName=G)["events"][0]["message"] == "hello" # correctNot CloudFormation-specific
Worth stating explicitly, because it sits next to #527: the group above is created by a direct CreateLogGroup call, no stack involved, and it fails identically. This is a general Logs plugin issue, not part of the CFN PascalCase family.
AWS::Logs::LogGroup deployed via CloudFormation is affected too, but only as a consequence.
Why this matters here
compute/ecs.py in parsl-aws-provider creates a /ecs/{family} log group before registering a task definition (ecs.py:377) and deletes it during cleanup (ecs.py:829), because ECS tasks fail immediately if the log driver cannot write to the group. Both are writes and both work.
The gap is that a test cannot verify either one: confirming the group was created, or confirming cleanup actually removed it, means calling describe_log_groups and reading logGroupName — which is exactly what returns {}. A cleanup assertion has to fall back on the returned count, which passes for the wrong reason.
Secondary: PutRetentionPolicy is unimplemented
Found while writing the reproducer:
botocore.exceptions.ClientError: An error occurred (InvalidAction) when calling the
PutRetentionPolicy operation: CloudWatchLogsPlugin: unknown operation "PutRetentionPolicy"
This one is at least loud rather than silent, so it is much less harmful. Mentioning it here rather than filing separately since it is the same plugin — happy to split it out if you would prefer.
Relatedly, RetentionInDays appears in the DescribeLogGroups payload when a retention policy exists (I saw it on an earlier probe of a CFN-created group that set one), so the field is modelled — just not settable through this operation.
Suggested fix
Add explicit lowercase JSON tags to the LogGroup, LogStream and OutputLogEvent element structs, matching whatever FilterLogEvents's FilteredLogEvent already does — that one is the working reference. Also worth grepping the plugin for other element structs serialised without tags, since the envelope-vs-element split above suggests this was systematic rather than three separate slips.
For a regression test, asserting on the JSON bytes rather than a Go round-trip is the thing that would have caught it: a Go struct marshalled and unmarshalled by the same struct definition agrees with itself whatever the casing, so only a wire-level or real-SDK assertion sees the mismatch.
Activity
scttfrdmn commentedon Aug 3, 2026
Confirmed and reproduced verbatim against
main(b3d1caa, v0.84.0+), CLI 2.x rather than botocore directly — same result, since both match response members case-sensitively against the service model:Your reading of the cause is exactly right, and the mechanism is worth stating precisely because it explains the envelope-vs-element split you noticed.
Root cause.
CWLogGroup,CWLogStreamandCWLogEvent(emulator/cloudwatchlogs_types.go) do carry explicit JSON tags — they are just PascalCase (json:"LogGroupName",json:"ARN",json:"CreationTime"). They are tagged that way because these three structs serve two purposes: they are the state representation (json.Marshal(lg)→state.Put,:105/:282) and the wire representation (embedded directly in the response envelope at:234,:399,:542). The envelopes are declared inline in each handler with correct camelCase tags, which is why the outer keys are right and only the members are wrong.FilterLogEventsis correct because it does not reuse the state struct at all — it declares a localfilteredEventtype with camelCase tags (:580) purely for the response. So the working reference you identified is working for exactly the reason that makes it a good model.That dual role is also the one constraint on the fix: retagging these structs in place changes the on-disk/state encoding as well as the wire encoding. Practically that is survivable — Go's
encoding/jsonunmarshals case-insensitively when no exact match exists, so a{"LogGroupName":…}value written by an older substrate still decodes into ajson:"logGroupName"field — but it is not free either.MemoryStateManager.Snapshot/Restore(emulator/state.go:99) round-trips raw namespace bytes, andbetty_debug.go's time-travel restore replays them, so a snapshot taken before the change and restored after it relies on that case-insensitive fallback rather than on an exact match. That is worth a line in the changelog, not a blocker.Given that, the cleaner shape is the
FilterLogEventsone: keep the state structs as they are and give each of the three read operations a response-only element type with camelCase tags. That separates "how substrate stores a log group" from "what the Logs API says a log group looks like", which is the distinction that got conflated here, and it means the fix cannot perturb state encoding at all.CWLogGroupis also read outside the plugin —LambdaPlugin.autoCreateLambdaLogGroup(emulator/lambda_plugin.go:954) writes one directly to avoid a registry cycle — so leaving the state type alone keeps that path untouched.Member names, checked against the API reference rather than inferred. Your list is right; three notes:
LogGroup:logGroupName,arn,creationTime,retentionInDays. Note the reference documents botharn(with a trailing:*) andlogGroupArn(without) as distinct members — substrate emits the no-trailing-:*form today, so the accurate mapping islogGroupArn, witharncarrying the:*suffix. Worth getting right rather than aliasing one to the other, since IAM policy examples key off the difference.LogStream:logStreamName,arn,creationTime,lastIngestionTime,uploadSequenceToken. The reference marksstoredBytesdeprecated (always zero since 2019-06-17) and notesuploadSequenceTokenis now ignored byPutLogEvents— substrate models the token, which is fine; no reason to drop it.OutputLogEvent:timestamp,message,ingestionTime. Exactly as you have it.The systematic question you raised — yes, and it is wider than Logs. I swept for it. The same "state struct marshalled straight onto the wire" pattern hits API Gateway, whose API is also camelCase:
Should be
id,name,rootResourceId,createdDate— same defect, same cause (APIGatewayRestAPIinemulator/apigateway_types.go:11is marshalled directly at:423). And note the second problem visible there:AccountIDandRegionare substrate's own state-partitioning fields, and they are on the wire, in a response no real API returns. MSK has the leak too (/v1/clustersreturnsAccountID/Region), though its casing is correct because the MSK API is natively PascalCase.I checked the ones where it would matter most and they are clean: ECS, ECR, Step Functions, Batch, Kinesis, EFS, Glue, Secrets Manager and SQS all put correct casing on the wire and leak nothing, because they build response types separately from state. So this is not repo-wide — it is the specific plugins that reuse one struct for both jobs.
Plan. Splitting this into two, because they are different defects with different blast radii:
PutRetentionPolicyandDeleteRetentionPolicy. KeepingPutRetentionPolicyhere as you suggested: it is the same plugin, one handler, andRetentionInDaysis already modelled and surfaced (you saw it on a CFN-created group), so it is settable-field plumbing rather than new modelling. Its documented errors areInvalidParameterExceptionfor an invalid day count (the valid set is a fixed list — 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653) andResourceNotFoundExceptionfor an unknown group, both 400, with an empty 200 body on success.DeleteRetentionPolicyis how the API says to make events never expire, so shippingPutwithoutDeleteleaves no way back.AccountID/Regionleak in API Gateway and MSK, since that is a different plugin and the leak is arguably worse than the casing (it invents observations, which is the thingdocs/fidelity.mdforbids).On the regression test — your last paragraph is the most valuable part of the report. You are right that a Go round-trip cannot catch this, and the existing test proves it:
emulator/cloudwatchlogs_plugin_test.go:78asserts through a locally-declaredstruct{ LogGroupName string \json:"LogGroupName"` }, i.e. it encodes the defect in the assertion and passes. The fix will assert on the raw JSON bytes (assert.Contains(t, string(body), `"logGroupName":`)plus a negative on"LogGroupName"`), and the existing assertion structs get retagged to camelCase so they would fail if the casing regressed.Milestoning for v0.88.0, which is already the "make the wire match the API" release — it carries #526/#527, the CloudFormation/ECS PascalCase family. You are right that this is not part of that family, and I have labelled it accordingly; it ships alongside them because it is the same class of silent-success defect and the same kind of test gap, not because it shares a cause.
Also noting the second-order finding this produced, filed separately:
DescribeComputeEnvironmentsandDescribeJobQueuesfail on Batch withInvalidAction: unsupported path /v1/describecomputeenvironments— the plugin creates compute environments and job queues but cannot describe them back, which is the same "a test can write but cannot verify" shape as yourdescribe_log_groupspoint.Thanks for the reproducer that creates its own group, and for calling out that a
len()assertion passes for the wrong reason — that is precisely why this survived.fix(logs): put camelCase member names on the wire for the read operat…
fix(s3): parse a notification configuration off the wire (#542) (#553)
fix(msk): return the response shape a Kafka SDK parses (#529) (#564)
fix(apigateway): return the v1 response shape an SDK parses (#529) (#565