Skip to content

Conversation

@hariohmprasath
Copy link
Contributor

Issue #, if available:
Lambda Extension to send logs directly to Kinesis firehose #51

Description of changes:
The extension explains the overall approach to streamline and and centralize log collection using Kinesis firehose. The extension runs a local HTTP listener and subscribes to a stream of function and platform logs using the Logs API. It buffers them and sends them to Kinesis firehose periodically. The demo gets deployed using AWS SAM.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

bullet-dev-team and others added 7 commits February 1, 2021 21:56
Code changes to launch the HTTP server in port 4000 because of conflict with Lambda insights. Updates to README file with information around performance testing
Copy link
Contributor

@julianwood julianwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may also be worth thinking about sending events per invoke. You can use the Platform runtimeDone messages to in effect wait until all the logs have arrived from Lambda before calling /next. This doesn't slow down the function response and makes for cleaner logs when the execution environment is frozen between invocations which may mean only receiving the logs during the next invoke.

@hariohmprasath
Copy link
Contributor Author

It may also be worth thinking about sending events per invoke. You can use the Platform runtimeDone messages to in effect wait until all the logs have arrived from Lambda before calling /next. This doesn't slow down the function response and makes for cleaner logs when the execution environment is frozen between invocations which may mean only receiving the logs during the next invoke.

Yep,
The code flushes logs only incase of Shutdown and runtimeDone events. Here is a snippet of it.

flushLogQueue := func(force bool) { for !(logQueue.Empty() && (force || strings.Contains(logsStr, string(logsapi.RuntimeDone)))) { // Flush logs } }

flushLogQueue(true/false)

Copy link
Contributor

@julianwood julianwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, just some working suggestions in the README for clarity and correct use of service names.

@hariohmprasath
Copy link
Contributor Author

Looking good, just some working suggestions in the README for clarity and correct use of service names.

Thanks @julianwood, all the changes are incorporated.

@julianwood julianwood merged commit a877db2 into aws-samples:main Aug 10, 2021
@julianwood
Copy link
Contributor

Thanks for contributing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants