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
Single log for multi line strings in AWS Cloudwatch #296
Comments
I am in the same situation, any progress? |
Will gladly review a PR if anyone has time to look into this. In the mean time, check out the middleware discussion here as I believe it provides a way to handle these kinds of cases without mutzing about with the core lib code |
For AWS Lambda, a simple solution is overriding debug.log = console.log.bind(console); This will result in each debug statement being grouped in one collapsable section. |
How do we filter strings with newlines ? |
Unfortunately, in our python 2.7 lambda we can't change our Perhaps we could log the messages as json objects. |
For future readers, use Example:
|
For those who came here by doing a Google search for "cloudwatch logs multiline" try searching for "cloudwatch agent multiline logs" instead. One of the results there is for https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html#CloudWatch-Agent-Configuration-File-Logssection which will tell you how to configure the CloudWatch agent to recognise the start of a new pattern. For example:
I don't know if the CloudWatch Agent can be configured like this in AWS Lambda but it works nicely for EC2. |
Hello, |
@bgth this isn't the place for AWS support, please contact Amazon or use Stack Overflow for such questions. |
Hey, I'm using debug for a node aws lambda where I make a request and log the response body.
If I use console.log it logs the entire body in one collapsible section in AWS cloudwatch (http://i.imgur.com/WQMVIGu.png), but if I use debug it creates a section for each line (http://i.imgur.com/cpLeEsr.png).
Is there an option or something to make it not do this multi section behavior? I tried using %j but it leaves the visible \n characters in the statement
The text was updated successfully, but these errors were encountered: