Control characters getting displayed in log

Sadashiv Kulthe sadashiv.linux at gmail.com
Thu Dec 13 11:28:15 UTC 2007


Hi,

I am using redhat servers and have lot modification in installation process
for application.

It asks many questions on command prompt and take input from user.

Reasons why control characters getting logged into logs are -

1. Script has a text-based menu-oriented UI, which uses control sequences to
move the cursor around the screen, change the color of the text, etc.
Therefore, the logged output contains control characters.

2. The message of a  install contains a Ctrl-G character to sound the
console bell/beeper (presumably to get the attention of whoever was
performing the installation).  That character is also logged to
/var/log/messages.

3. Messages from Linux RC scripts often contain control sequences to print
their status in either green (success) or red (failure).  These messages may
be logged to /var/log/messages.


*I want to avoid control characters getting logged into logs. How can I do
this?*

Control characters looks like

Nov 29 14:25:48 localhostconfig: ^[6 ^[6^[[1;1H
Nov 29 14:25:50 localhost config:
^[[6;11H^[[0m^[[30m^[[47m+^[[30m^[[47m--------------^[[0m^[[30m^[[47m+
^[[31m
^[[30m
+^[[30m^[[47m---------------^[[0m^[[30m^[[47m+^[[7;11H|
|^[[1m^[[37m^[[40m ^[[8;11H^[[0m^[[30m^[[47m|
           |^[[1m^[[37m^[[40m
^[[9;11H^[[0m^[[30m^[[47m|
|^[[1m^[[37m^[[40m ^[[10;11H^[[0m^[[30m^[[47m|
 Station on   |^[[1m^[[37m^[[40m ^[[11;11H^[[0m^[[30m^[[47m| an already
installed and running
      |^[[1m^[[37m^[[40m
^[[12;11H^[[0m^[[30m^[[47m|
|^[[1m^[[37m^[[40m
^[[13;11H^[[0m^[[30m^[[47m|
|^[[1m^[[37m^[[40m ^[[14;11H^[[0m^[[30m^[[47m|
^[[37m^[[41m+-----+^[[30m^[[47m
^[[37m^[[41m+----+^[[30m^[[47m            |^[[1m^[[37m^[[40m
^[[15;11H^[[0m^[[30m^[[47m|          ^[[37m^[[41m|^[[31m^[[47m Yes
Nov 29 14:26:10 localhost  : ^[[14;22H^[[0m^[[30m^[[47m       ^[[15;22H
^[[37m^[[41m+-----+^[[16;22H^[[30m^[[47m ^[[37m^[[41m|^[[31m^[[47m Yes
^[[37m^[[41m|^[[17;23H+-----+^[[16;29H

Regards,
Sadashiv Kulthe



More information about the redhat-list mailing list