When I configured the Cluster Logging,I select the Elasticsearch service.The service collects both standard and error events success.However when I review the events collected by kibana,the logging disorderly code is like this :
I got the file from the the
/var/log/containers
directory on each of your nodes.I find the json is like this:"\u001b[2m2020-12-02 10:37:26.271\u001b[0;39m \u001b[32m INFO".The disorderly code is “\u001b[2m”.Is it the color setting?How can I set the logging format to delete the color setting for logging? hope you can help to solve the problem,thank you very much!
Those are ANSI color escape codes, yes. But logging just logs what it’s given; if you want to change what’s logged you need to change what the application produces.
It may have an option to not do colors, or may automatically be detecting that it’s running inside a tty (which is an option in the container definition) and outputting color because of that.
Thank you for your reply.I find the logging is having color by using the command:“docker logs -f xxxx”.
But,When I run the image(created by the same dockerfile) without rancher,just using the command:“docker run -d xxxx”,I find the logging is not having color.So,I think the rancher maybe do something to configure that.How can I do to solve this problem?Thank you!
Again my guess would be the image looks for the presence of a tty, and the container is run with one (which is an option in the container definition, equivalent to docker run -t ...
).