klauern
1/30/2009 - 9:12 PM

A RegEx for searching JCAPS 5.1.x server.log files

A RegEx for searching JCAPS 5.1.x server.log files

Here is a regular expression listing:

Find comments in server.log files (JCAPS 5.1.3)
(\[#\|(.|\s)*(?#Insert which things you're looking for here.  Be it BehavScor|Thing|Thin|)\|#])
The above regex (minus the (?#...) portion)

\[#\|(.|\s)*wefwefw(.|\s)*\|#]

The wefwefw portion is merely a marker for whatever you're really looking for.  Say you want to look for your project's svcJcdwhatever, you would put that there.
In the case that you're looking for MULTIPLE things contained in a message log, you would pipe an OR inside of it like so:

\[#\|(.|\s)*wefwefw|wohbnwoh(.|\s)*\|#]
Where now it will look for comment strings that contain EITHER wefwefw OR wohbnwoh.

Finally, to cap this all off, you want to apply this to your server.log file in real time:

$ tail -f server.log | /usr/xpg4/bin/grep -e "\[#\|(.|\s)*wefwefw|wohbnwoh(.|\s)*\|#]"

Seems a little lengthy, so I may shrinkwrap this entire call into a script.