mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
* fix(lambda): send a function's logs to the log group its LoggingConfig names Floci stored LoggingConfig.LogGroup and read it back, but every execution environment still wrote to /aws/lambda/<name> and told the function so in AWS_LAMBDA_LOG_GROUP_NAME. Measured on AWS (eu-west-1, 2026-10-16): a function whose LoggingConfig names a group writes INIT_START, START, its own output, END and REPORT there, Lambda creates the group when it is missing, and /aws/lambda/<name> is never created. AWS_LAMBDA_LOG_GROUP_NAME and AWS_LAMBDA_LOG_STREAM_NAME name that group and stream. Once LoggingConfig names a group, which several functions can share, each stream's name carries the function's name: 2026/10/16/my-fn[$LATEST]<id> instead of 2026/10/16/[$LATEST]<id>. It does even when the group named is /aws/lambda/<name> itself, so the rule is whether a group is named, not whether it differs from the default. Both launchers, Docker and Kubernetes, and GetFunctionConfiguration's LoggingConfig now take the group and the stream from one place, LambdaLogDestinations. Floci skips delivering a log group to a Lambda subscription destination that writes its own logs there, which would feed the function its own output forever. That check assumed the group was /aws/lambda/<name>, so a forwarder subscribed to the group its LoggingConfig names would loop. It now asks LambdaLogDestinations for the function's group, and falls back to the default name, from the same place, for a function it cannot find. * fix(logs): skip only a function's own streams when it forwards its log group The guard that keeps a subscription from feeding a Lambda destination its own output looked the function up by name in the caller's account and Region at $LATEST, and skipped the whole group once it matched. In a group LoggingConfig names, which several functions can share, a forwarder then lost every other function's logs; a destination naming a published version or alias was checked against $LATEST's group; and a function in another account than the ambient one was not found, so its own custom group was fed back to it. The function is now the one the destination ARN names, through getFunctionByArn, with its account, Region and qualifier, and in a named group only the streams carrying its name are skipped, the shape measured on AWS for a named group (2026/10/16/<name>[$LATEST]<id>); every stream of the default group is still the function's own. A destination ARN that does not parse as a function's is not a loop and is no longer caught as any RuntimeException. Tests: another function's stream in a shared group reaches the forwarder while its own is skipped, and a destination naming a published version is checked against that version's group (both fail on the previous head); the stream ownership rule in LambdaLogDestinationsTest.