Special Character Issue on console logs output

Hi All, I need help with clear up those weird character’s from console output we are using OD version 2019 6.3 LTS, I wanted to see those terraform outputs as is how it looks on my terminal or CI/CD pipeline output if someone has any idea how to approach this issue would be really appreciate and thank you in advance.


Hi @atabekbekenov,

Thanks for getting in touch with your great question! I’ve only recently worked on resolving what might be this exact behavior in the following thread, and I hope this helps get this resolved for you quickly. :slight_smile:

In that case it came down to a couple potential solutions:

  1. Replace these ANSI color codes, finding them via regex: -replace '\x1b\[[0-9;]*m',''
  2. If this is run on PS Core on Linux, the following will render the output as plain text.
# Fix ANSI Color on PWSH Core issues when displaying objects
if ($PSEdition -eq "Core") {
    $PSStyle.OutputRendering = "PlainText"
}

Let me know if either of those solutions help at all, otherwise I’ll be happy to jump into testing this one!

Best regards,

Kenny

Thank you for the quick reply I gave it try this PWS script but unfortunately, it did not work for me or I could not make my outputs still look the same, this service is running on Linux OS I forgot to mention that sorry, how could I convert this script to bash? And still does not make sense why only it happening on OD task logs our all other outputs are clean. For now, only our terraform deployment outputs look like this. If you could help me would be great I’m very new to OD.

Hi @atabekbekenov,

Thanks for following up, and no worries! I believe this issue is similar to the other one I linked to previously, in that these characters look like ANSI colors. I’m curious if you instead add the -no-color flag on to your terraform command, does that remove these color codes (referencing Terraform docs)? For example terraform output -no-color -json

Best regards,

Kenny

1 Like