In a Linux terminal (CentOS) I am using the command tail --follow=name my-rolling-file.log
in order to see the logs of my application.
Sometimes in the log, there is some binary data dumped (I dump the body of a Camel Message that usually contains strings, but sometimes binary and/or special characters like Chinese in UTF-8) and when it happens my terminal gets corrupted like the pipe characters |
are now รถ
instead.
I just guessed it is the binary data logging who can cause the problem and I am wondering if it is possible to ask the tail
command to ignore special characters. I checked the man page but did not find anything there.
Currently to fix the problem I have to Ctrl-C
the tailing, make a reset
in the terminal and relaunch the tail
command. I want to prevent these operations if possible.
If you know another command than tail
, but with the same features (following rolling files) it would be acceptable as well as long it is installable and runnable under CentOS 6.5.
Best Answer
What about this,
The default for
strings
is that it will only output printable characters in lengths of 4 (or more), but you can change this with-n {number}
.