New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iterate over log events & post them individually #7
Conversation
Thanks @dgarlitt! I notice the code to extract and include RequestID as a separate field in the JSON to Sumo was removed. Since this was actually requested by some customer, it would be good to have it back. I am thinking about making it optional if not everyone needs it. |
e70ebe1
to
cb65f9a
Compare
@duchatran Good catch, it's updated to include that logic. |
de64c74
to
3be0966
Compare
@duchatran I just updated this commit again to adjust the formatting on the options object at the top so that they are all in line. It was strictly cosmetic. Let me know if there are any other concerns about this pull request. |
Thanks @dgarlitt. Sorry for not getting back sooner, was caught up with something else. Let me do some test and then I will merge this. |
👍 Thanks! |
var tot = requestsSent + requestsFailed; | ||
if (tot == awslogsData.logEvents.length) { | ||
if (requestsFailed > 0) { | ||
context.fail(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context.fail
and context.succeed
allow to pass in a string value. Changing your code to this might be a nice optional addition:
if (requestsFailed > 0) {
context.fail(requestsFailed + " / " + (requestsFailed + requestsSent) + " events failed");
} else {
context.succeed(requestsSent + " requests sent");
}
d8dbb07
to
44f5b44
Compare
@thoean I amended the commit to include the change regarding your suggestion on adding info to context.fail(). Github is having issues right now, so it may be a bit before the "Checking for ability to automatically merge..." status goes away. |
d8dbb07
to
de457d4
Compare
CloudWatch often bundles multiple log events together in the event input archive that is passed in the lambda's event argument. Since the lambda was only doing a single post to the collection, that post would in many cases actually contain multiple logs which would then show up as a single concatenated log in the collection resulting in incorrect metrics. This change iterates over the log events in the archive and posts them individually to the collection.
de457d4
to
524772f
Compare
@thoean Added info to context.succeed() as well. Good suggestion, btw. |
CloudWatch often bundles multiple log events together in the event input
archive that is passed in the lambda's event argument. Since the lambda
was only doing a single post to the collection, that post would in many
cases actually contain multiple logs which would then show up as a
single concatenated log in the collection resulting in incorrect metrics.
This change iterates over the log events in the archive and posts them
individually to the collection.