Running Node.js on Heroku.
The app's log messages are exported to AWS CloudWatch, by using the following aws-cloudwatch-forwarder
NPM library (which brilliantly wraps the node app and sends everything to AWS CloudWatch).
Everything is perfect except the fact that multi-line log messages are broken into separate log messages.
For example:
aaa = {
"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "true",
"AWS_REGION": "eu-west-3",
}
is being reported to AWS CloudWatch like this:
11:07:34 aaa = {
11:07:34 "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "true",
11:07:34 "AWS_REGION": "eu-west-3",
11:07:34 }
I've tried the following non-working solutions:
- Replacing every
'\n'
with'\n>>>'
(according to this). - Replacing every
'\n'
with'\n\t'
or'\n ' /*mind the space*/
(according to this). - Replacing every
'\n'
with'\r'
(according to this). - Saw this unanswered question.
- Also looked everywhere online.
Does anyone knows how to send the message as one multi-line message??? like this:
11:07:34 aaa = {
"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "true",
"AWS_REGION": "eu-west-3",
}