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).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With