Wearing earplugs

We recently upgraded to Alfresco While we’re definitely happy to be up on the new version (lots of nice new features), one issue has been bugging me: There’s an awful lot of noise in the log file.

Back in 3.4.x, I usually monitored the log file with the command:

tail -500f /usr/share/tomcat/logs/catalina.out | grep -v "^\Wat"

What that does is to strip out all of the stack traces from the log (all of the lines beginning with ” at”), making the log file much more readable. As this was just affecting which lines are displayed, not what’s actually in the log file, I could turn off the grep filtering if I ever wanted the complete version for troubleshooting.

However, in, there’s a lot more spurious stuff in there. In addition to the stack traces, there’s also:

1) Very frequent repetitions of the lines:

Sep 7, 2012 3:35:03 PM org.apache.tomcat.util.http.Parameters processParameters
WARNING: Parameters: Invalid chunk '' ignored.

2) Complete copies of the raw HTML of the error page served up whenever a HTTP 500 (internal error) error occurs.

3) A bunch of blank lines

So, this afternoon, after a bit of chatter about this on the Alfresco IRC channel, I decided I really needed a better version of my log file monitoring command. Here’s what I developed:

tail -7500f /usr/share/tomcat/logs/catalina.out | perl -nle 'print if (($_ !~ /^\W*[<a\.]/) && ($_ !~ /^$/) && ($_ !~ /org.apache.tomcat.util.http.Parameters processParameters/) && ($_ !~ /Invalid chunk/))'

Note that the line above scrolls sideways so it doesn’t get word-wrapped incorrectly.

To break down the individual portions of that perl “print if” command:
($_ !~ /^\W*[<a\.]/): Don’t print any lines that begin with whitespace (optional), followed by either a “<” (getting rid of the error 500 HTML lines); an “a” (getting rid of the ” at” lines); or a “.” (getting rid of the ” … 40 more” lines)

($_ !~ /^$/): Don’t print any blank lines

($_ !~ /org.apache.tomcat.util.http.Parameters processParameters/): Get rid of the lines containing “org.apache.tomcat.util.http.Parameters processParameters”

($_ !~ /Invalid chunk/): Get rid of the lines containing “Invalid chunk”

This isn’t an earth-shattering improvement, but it does make the log file a bunch easier to read, for me at least.

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Wearing earplugs

  1. JNoob says:

    Good job on the grep tools for making the logs more readable! Saves me a lot of time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s