Commit Graph
9 Commits
Author SHA1 Message Date
Sam Fakhreddine 4435c62848 feat(logs): add AssociateKmsKey and DisassociateKmsKey for log groups (#2584)
* feat(logs): AssociateKmsKey / DisassociateKmsKey for log groups

floci had no CloudWatch Logs KMS association at all, so LZA's
Custom::UpdateSubscriptionFilter Lambda got UnsupportedOperation, the
resource reported FAILED, AWSAccelerator-LoggingStack rolled back, and
CDK's readback surfaced the misleading "NoStack: CloudFormationStack
object does not hold a stack".

The Lambda reads logGroup.kmsKeyId from DescribeLogGroups and only calls
AssociateKmsKey when it differs from the target key ARN, so storing the
association is not enough -- DescribeLogGroups has to echo kmsKeyId back
or the association never converges and it re-associates every deploy.

- LogGroup: kmsKeyId field
- CloudWatchLogsService: associateKmsKey / disassociateKmsKey, both
  ResourceNotFoundException on an unknown group; associate rejects a
  blank kmsKeyId with InvalidParameterException
- CloudWatchLogsHandler: AssociateKmsKey / DisassociateKmsKey actions
  (name or ARN identifier), and kmsKeyId emitted by DescribeLogGroups
  only when a key is associated

(cherry picked from commit d548de18dc5c5dc8de96cb3b37a3935915be9da2)

* fix(logs): accept resourceIdentifier on Associate/DisassociateKmsKey and require an identifier

The ARN alternative for these two operations is resourceIdentifier on the
wire (unlike the query operations' logGroupIdentifier), so SDK requests
identifying the group by ARN previously failed with ResourceNotFoundException.
A request with neither identifier now returns InvalidParameterException
instead of resolving a null group name. Both actions documented in the
cloudwatch supported-actions table.

* fix(logs): reject KMS requests naming both logGroupName and resourceIdentifier

AWS models the two identifiers as mutually exclusive — exactly one is
required. Supplying both previously succeeded against the named group
while silently ignoring the ARN target.

* fix(logs): enforce the modeled input constraints on the pre-existing operations

logEvents (1-10000 on PutLogEvents), logStreamNames (1-100 on
FilterLogEvents) and the Random/ByLogStream distribution enum on
PutSubscriptionFilter now answer the modeled InvalidParameterException
instead of being accepted verbatim. Included here because this PR
already hardens the same handler; found by a model-grounded constraint
sweep.

* fix(logs): treat a present-but-blank KMS target identifier as present

A blank logGroupName beside a valid resourceIdentifier slipped past the
exclusivity check as "absent" and the mutation proceeded on the valid
field. Presence is now membership (non-null), and a blank chosen
identifier is rejected outright — the model pins both to min length 1.

* fix(logs): store kmsKeyId on CreateLogGroup, reject query-result identifiers, and treat null lists as absent

CreateLogGroup modeled kmsKeyId but the handler never read it, so an
encrypted-at-creation request was accepted, stored nowhere, and absent
from DescribeLogGroups. Both AssociateKmsKey and DisassociateKmsKey
resolve resourceIdentifier through extractLogGroupNameFromArn, which
only recognizes the :log-group: form; the modeled :query-result: form
(account-wide GetQueryResults encryption, a separate feature) fell
through unchanged and became a misleading ResourceNotFoundException
naming a log group the caller never specified. FilterLogEvents also
used request.has("logStreamNames"), which is true for an explicit
JSON null, tripping the min-1 bound the same way an empty array does;
AWS treats an explicit null on an optional member as absent.

Fixes all three: plumb kmsKeyId through a new createLogGroup overload
and store it when non-blank; recognize and reject the query-result
resourceIdentifier form as unsupported instead of mangling it;  switch
to hasNonNull for logStreamNames, matching the idiom already used in
resolveKmsTargetLogGroupName. Also fixes requireListSize's
fully-qualified JsonNode parameter and a stray blank line.
2026-08-27 10:50:05 -04:00
Aniket Shukla 859db2f352 feat(cloudwatch-logs): add resource policy actions (#2574) 2026-08-25 23:41:09 -05:00
TiM 112602fc6e fix(cloudwatch): page FilterLogEvents forward with a usable nextToken (#2354)
FilterLogEvents returned UUID.randomUUID() as its nextToken and had no
nextToken parameter to accept one back, so a response could advertise more
results while giving a client no way to reach them. Truncation compounded it:
the time and pattern filters ran before .limit(maxEvents) over an
ascending-sorted list, so an over-cap query kept the oldest matches and the
newest were unreachable. The canonical use of this action is finding the error
that just happened across a group, which is exactly the event most likely to be
dropped.

Accept a nextToken and make it an f/<index> offset into the matched set,
reusing the parser GetLogEvents already validates its tokens with so a
malformed, negative or overflowing token raises InvalidParameterException here
too. The offset indexes matches rather than stored events, so a request
narrowed by pattern, time range or stream names pages through only what it
matched.

Emit the token only when a further page exists, unlike GetLogEvents which
echoes its forward token back. The two AWS actions signal exhaustion
differently: FilterLogEvents documents an absent nextToken as "pagination is
finished", and its SDK paginators keep requesting while the token is present
with no same-token guard, so echoing a final token would never terminate. Also
refuse to emit a cursor that cannot advance, which a max-events cap configured
to zero would otherwise produce, and compute the page end by subtracting from
the total so a cap near Integer.MAX_VALUE cannot overflow the index negative.

startFromHead is still unsupported, so results run oldest first.
2026-08-17 13:25:47 -04:00
Saatvik Arya 4215006fe2 feat(logs): support log group deletion protection (#2256)
* fix(logs): accept log group deletion protection lifecycle

* feat(logs): support log group deletion protection
2026-08-12 22:39:39 -04:00
soreavis f1c81977ec fix(cloudwatch): warn on unsupported Logs Insights filter operators (#2170)
parseFilter scans for the leftmost '!=', '==' or '=' outside a quoted
value, so the '=' inside '>=', '<=' and '=~' won. For '>=' and '<=' the
comparison character was absorbed into the field name ("@message >"),
which resolves to null for every row, and passesFilters treats null as
non-matching; for '=~' the value became the literal "~ /ERROR/". Either
way the query came back with no rows and no warning, because as far as
parseFilter was concerned it had found a valid operator.

Stop the scan when a position starts one of those three operators, so
control reaches the "Ignoring unsupported Logs Insights filter" warning
that '<', '>', 'like', 'not like' and 'in' already hit, and the stage is
dropped instead. Quote tracking is untouched, so a '>=' inside a quoted
value is still just part of the value.

The docs table describing how unsupported syntax degrades had the same
two cases inverted: '=~' listed as warn-and-drop when it mis-parsed, and
bare '<' / '>' as silent-zero-rows when they already warned. Folded into
the one row that now matches the code, and the compound and/or mis-parse
this change does not fix got its own row instead of staying implied.

Refs #2042
2026-08-12 10:52:24 -04:00
武田隆志 86134e8c7f docs(cloudwatch): document Logs Insights subset and missing Logs actions (#2044)
docs/services/cloudwatch.md listed 14 of the 24 actions that
CloudWatchLogsHandler dispatches. The handler is on the deferred_handlers
allowlist in tools/docs/services.yaml, so the table is maintained by hand and
had drifted as actions were added.

Most notably Logs Insights (StartQuery / GetQueryResults / StopQuery, added in
1.5.31) was undocumented, leaving no way to discover which parts of the query
language are implemented.

Add the 10 missing actions and a Logs Insights section covering the supported
commands, the field syntax, and how each kind of unsupported input degrades:
a dropped filter stage returns every row, a >= or <= comparison is mis-parsed
into a field name and returns none, a missing projected field becomes an empty
string, and an unrecognised sort direction falls back to ascending.

Also note the PutSubscriptionFilter and GetDataProtectionPolicy
simplifications, document
FLOCI_SERVICES_CLOUDWATCHLOGS_QUERY_COMPLETION_DELAY_MS in both the service
page and the central environment-variable list, correct the
MAX_EVENTS_PER_QUERY description, and add a start-query example.
2026-07-29 23:38:24 -05:00
Hector Ventura 9e35046647 Docs/enviroment instead yml (#764)
* docs: moving all config to env instead of yml
* docs: sync with main and new features
* docs: reverting docker-compose.yml
2026-05-10 11:53:31 -05:00
TiM a32b7f1f3b docs: comprehensive audit sweep + CHANGELOG backfill (1.1.0-1.5.2) (#326)
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs
had drifted from code behaviour. This sweep reconciles docs against the
current codebase on upstream/main.

- Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history
- Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58),
  Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the
  actual dispatch handlers rather than @Path annotation counts.
- Rewrite README "Supported Services" table to drop per-service op counts
  (they drift too fast); point readers at docs/services/index.md
- Update 24 service docs for accuracy, add "Not Implemented" sections
  where relevant (s3.md, lambda.md, api-gateway.md)
- Refresh configuration and getting-started docs
- Add EventBridge Scheduler and AppConfig to mkdocs nav
- Add AppConfig / AppConfigData rows to README and services index
  following the 1.5.2 upstream release
2026-04-10 10:52:34 -05:00
Hector Ventura 61433f59ab firt commit 2026-03-15 17:43:56 -05:00