Skip to content

Instantly share code, notes, and snippets.

@klauern
Created January 30, 2009 21:12
Show Gist options
  • Save klauern/55262 to your computer and use it in GitHub Desktop.
Save klauern/55262 to your computer and use it in GitHub Desktop.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment