How to get properly encoded apache error.log with tailf? How to get properly encoded apache error.log with tailf? apache apache

How to get properly encoded apache error.log with tailf?


After couple tries I found the solution.

echo -e -- to get utf insead of hex.

tailf ... | while read line; do command; done; -- to read output of tailf by line

read -r -- to avoid of convert escape sequence.

So, result is:

tailf /var/log/apache2/error.log | while read -r line; do echo -e "$line"; done;


I think you might need to use enca in your case, and if you don't know exactly what type of output encoding you have you might also use the options available in it such as -g, --guessyou can have it from gitorious.

a simple description, and I'm paraphrasing here:

If you are lucky enough, the only two things you will ever need to know are: command

enca FILE

and to know what type of encoding your file uses you can try:

enconv FILE

obviously you will need to replace FILE with your error log. after that you can simply try something like:

tail -20f /path/to/your/file/error_log

to download your file.