Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS CodeBuild Colorized logs

I'm trying show colorized logs using colored from termcolor inside my script, when I run my script locally all is OK, but when my script is running by aws codePipeline --> codeBuild, the output format look like termcolor is not working.

First image show current output on aws.

Second image show the output from my local IDE (VS Code)

In my script I use something like: print(colored('Validating ObjecstNamePrefix parameter value...', 'yellow')) to show yellow text

The image number 3 show how I install (correctly) termcolor in my spec.yaml

The last image show a blue output, this output color is not handled from my script, is handle originally from aws logs console, for me this means that is possible play with colors.

Any help to solve it is welcome!

This is the current output on aws

This is the desired output (how look on my local)

installing termcolor

blue output from aws original log

like image 465
Jorge López Avatar asked Sep 23 '19 16:09

Jorge López


1 Answers

Showing colors in Build logs tab on the Codebuild console is currently not possible. The blue color you mentioned is CodeBuild's internal implementation.

The reason for this gap is that the logs on the Build Logs tab are streamed from CloudWatch to the CodeBuild console. CloudWatch has no notion of fixed width fonts and colors. This makes any ASCII art of colors/indentations to not persist.

like image 140
shariqmaws Avatar answered Oct 04 '22 23:10

shariqmaws