2

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:

  1. Replacing every '\n' with '\n>>>' (according to this).
  2. Replacing every '\n' with '\n\t' or '\n ' /*mind the space*/ (according to this).
  3. Replacing every '\n' with '\r' (according to this).
  4. Saw this unanswered question.
  5. 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",
}
A-S
  • 2,547
  • 2
  • 27
  • 37

0 Answers0