Tuesday, October 14, 2014

PeopleSoft - Mining Linux based Web/App Server Logs Using find, egrep, awk commands

This post is based on information provided to me by an ex-colleague, friend and the best PS Admin I have worked with Danny Kile. I use this regularly and find it very effective when we need to quickly investigate issues particularly in a Production Environment (with several instances of the web/app server domains).

# Change Directory to where the logs reside
# Note: I changed the directory to the appserv folder so the search would go through
# multiple domain folders (if they exist)
cd /%PS_CFG_HOME%/appserv/

# If you want all the output printed
find . -name 'APPSRV_1014.LOG' | xargs egrep '*Search Text*'

# If you just want the number of times the 'Search Text' was found
find . -name 'APPSRV_1014.LOG' | xargs egrep '*Search Text*' | wc -l

# If you want multiple days worth
find . -name 'APPSRV_101*.LOG' | xargs egrep '*Search Text*' | wc -l

#If you want to aggregate based on day or hour, etc.
find . -name 'APPSRV_101*.LOG' | xargs awk '/*Search Text*/{freq[$3]++} END {printf "\n";for(day in freq){printf "%s\t%d\n",day,freq[day];}printf "\n";printf "\n";}'

Hope this is useful. Please share any other commands/scripts that might come in handy for PeopleSoft Developers.

No comments:

Post a Comment