Skip to content

feat(cloudwatch): display lambda logs#681

Merged
fdelbrayelle merged 9 commits intokestra-io:mainfrom
shivamwayal37:feat/lambda-cloudwatch-logs
Jan 30, 2026
Merged

feat(cloudwatch): display lambda logs#681
fdelbrayelle merged 9 commits intokestra-io:mainfrom
shivamwayal37:feat/lambda-cloudwatch-logs

Conversation

@shivamwayal37
Copy link
Contributor

What changes are being made and why?

closes #8978 re-submit of #677

This PR adds support for fetching CloudWatch Logs for AWS Lambda invocations and streaming them directly into the Kestra task logger.

Key changes:

Reusable Log Polling: Introduces a CloudWatchLogs abstraction to query logs via the FilterLogEvents paginator.

Enhanced Observability: Modifies the Invoke task to fetch and log Lambda execution logs, making debugging significantly easier.

Resilient Logic with RetryUtils: Utilizes Kestra's native RetryUtils to handle CloudWatch ingestion latency. This ensures logs are captured even if they aren't immediately available after the invocation.

Project Alignment: Updated kestraVersion to 1.2.0 to support the aforementioned RetryUtils and synced with main to include CI stability fixes from #679.


How the changes have been QAed?

Verified using InvokeUnitTest with mocked CloudWatch responses and tested against a live AWS environment. Streamed logs are prefixed with [lambda] for clarity.

id: lambda_with_logs
namespace: dev
tasks:
  - id: invoke_lambda
    type: io.kestra.plugin.aws.lambda.Invoke
    functionArn: "arn:aws:lambda:eu-central-1:123456789012:function:test"
    accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID') }}"
    secretKeyId: "{{ secret('AWS_SECRET_ACCESS_KEY') }}"
    region: "eu-central-1"

Setup Instructions

Standard AWS credentials are required. The IAM identity must have the following permissions:

  • lambda:InvokeFunction
  • logs:FilterLogEvents (to fetch the streamed logs)

Contributor Checklist ✅

@github-project-automation github-project-automation bot moved this to To review in Pull Requests Jan 24, 2026
@MilosPaunovic MilosPaunovic requested review from a team and fdelbrayelle January 26, 2026 07:11
@MilosPaunovic MilosPaunovic added area/plugin Plugin-related issue or feature request kind/external Pull requests raised by community contributors labels Jan 26, 2026
@fdelbrayelle
Copy link
Member

Hi @shivamwayal37 👋 Could you check and fix the CI please 🙏 ?

@shivamwayal37
Copy link
Contributor Author

Hi @fdelbrayelle,

I wanted to share some context on the recent RetryUtils refactor and Kestra version bump.

The original fix you reviewed and approved (commit 6b2b5a2) was intentionally simple (manual polling with bounded retries) and proved stable:

  • no CI failures
  • clean unit tests
  • no Kestra version bump
  • no additional framework coupling
  • confirmed working in the Kestra UI as well (as shown in the screenshots you requested)

After that approval, I was advised to switch to RetryUtils and bump Kestra from 1.1.0 → 1.2.0. I spent significant time trying to make this work correctly (tests, LocalStack, mocked contexts, VariableRenderer, etc.), but in practice it introduced instability and extra complexity in plugin-aws, especially around tests and CI reliability.

At this point, the RetryUtils + version bump path isn’t giving a clean or maintainable result for this plugin, whereas the original implementation you approved was stable and aligned with the existing codebase.

Given this, I’m reverting to the original fix (without RetryUtils and without the Kestra version bump), as it delivers the same functionality with lower risk and better stability.

Happy to revisit RetryUtils later if plugin-aws is formally aligned with 1.2.x across the board.

Thanks again for your earlier review, time and guidance — really appreciate it.

@fdelbrayelle fdelbrayelle changed the title Feat/lambda cloudwatch logs feat(cloudwatch): display lambda logs Jan 27, 2026
@fdelbrayelle fdelbrayelle merged commit 5ab273a into kestra-io:main Jan 30, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from To review to Done in Pull Requests Jan 30, 2026
@shivamwayal37
Copy link
Contributor Author

Great to see this merged! Thanks for the support and the thorough reviews @fdelbrayelle. This will make debugging Lambdas much easier for everyone. See you in the next PR!

@fdelbrayelle
Copy link
Member

Thank YOU @shivamwayal37 ;-) !

@shivamwayal37 shivamwayal37 deleted the feat/lambda-cloudwatch-logs branch February 1, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/plugin Plugin-related issue or feature request kind/external Pull requests raised by community contributors

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Fetch logs from AWS lambda

3 participants