Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

log to specific logstream in cloudwatch from lambda

I'd like to log to a specific CloudWatch log stream from lambda.

Currently, each lambda that fires off logs to a uniquely-named log stream, and often creates a new log stream as needed. This is problematic if I fire off 10 lambdas simultaneously with different events to process and want to look at the particular log stream for a given event type (that I could hypothetically define beforehand).

I'd like to be able to create a log stream in the console and specify to log to that particular log stream from within my lambda (python code), ideally without resorting to the boto3 module (although that's fine if it's the only way, of course).

enter image description here

like image 395
ryantuck Avatar asked Aug 29 '16 17:08

ryantuck


People also ask

How do I send lambda logs to CloudWatch?

Go to the Triggers tab of your Lambda function. Select Add Trigger. In the Add Trigger prompt, click the box as instructed and select CloudWatch Logs from the drop-down menu. Select a CloudWatch Log Group to add to your function.


1 Answers

This is a comment from @scolestock... It doesn't answer the question exactly (which I was hoping I'd find) but is a great alternative that helped me.

Use the "Search Log Group" option that appears above all the streams for a given log group? This will show the aggregate activity across the streams (and you let you search.)

That's basically what I need... viewing all logs across all streams.

like image 152
Jason Capriotti Avatar answered Oct 09 '22 14:10

Jason Capriotti