Hi @wajika,
You could use a filebeat processor to remove the ANSI codes from the log entries. The script processor looks like a good option here.
An alternative would be to use an ingest pipeline with the Gsub processor.
For the replacement logic, you can try one of the following regex to find a replace the codes: