Showing color in log output using tail command when using Cygwin?

Aubrey: 02 February 2022

I have a debian install that runs an application server.

I ssh into this debian install from a Windows computer using cygwin and with the application server running I use tail -f to monitor the log files.

Errors from the application are printed in red, warning in yellow, and all other output is the console text color.

However, when I run a nearly identical application server in Windows, and use cygwin to print the log from the filesystem, the log is not colored the way it is when ssh'd into debian.

Is this a difference in the tail command installed in debian and in cygwin? How can I emulate this behavior in cygwin?

Madison: 02 February 2022

tail is capable to visualize colors if the source is providing the correct escape codes. Eg:

ls --color=always |tail -f

Likely the Windows logs are not providing them. You can check with

$ od -c logfile

$ ls --color=always |od -c 
0000000 033   [   0   m 033   [   0   1   ; 3   2   m   a   .   e   x 
0000020 e 033   [   0   m  \n   A   0   2  _   C   a   m   p   _   d