Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Please look in to the picture,here am trying to open(with vi editor) my server console log file(around 100MB) and it takes more than two minutes to open with so many special characters.after deleting the first line (means typing "dd")then i can easily view the file and size of the file is also reduced very much.My server OS is RHEL 5.4 and jboss is running in to it.

Please help me to avoid such junk characters coming to my server console log files and it helps me to save my valuable space in server.

alt text

share|improve this question
    
What console log are we talking about? –  ring0 Jan 15 '11 at 11:33
    
Those are nulls. Any idea what's writing them to your log? That's pretty weird. –  Dennis Williamson Jan 15 '11 at 15:03
add comment

2 Answers

up vote 1 down vote accepted

simplest way would be filter non-printable chars, like that

cat console.log |perl -pe 's/[^[:print:]\n]//gi' > cleared_log.file

or just

perl -pe 's/[^[:print:]\n]//gi' console.log

But best way would be to figure out why u have such a junk in that log file

share|improve this answer
add comment

In VI, a ^@ represents a NULL (ASCII value 0) character. Googling for appears to suggest this is a known issue with JBoss and Logrotate. Check this website for some insight and a suggested fix:

http://efreedom.com/Question/2-71341/JBoss-Logrotate-Create-Log-Files-Full-NUL-Characters

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.