Juan Kinunt wrote:
Can you share the script that you use to parse the logs?

Norm Scherer wrote:

I grab them out of the logs using a cron job which mails the results to me.
This is just a simple script that greps for invocation of the login controller and mails it out. It also picks out errors (the only the string .html comes up) an tells me about them. I would not call it realtime as I just run it once a day in the dead of night (at least for me if not for everyone).

#!/bin/sh
# things to do for nightly maintenance
# parse options

E_WRONGARGS=85  # Non-numerical argument (bad argument format).
NARGS=1
ARGS="customer"

if [ $# -ne $NARGS ]
then
 echo "Usage: `basename $0` $ARGS"
 exit $E_WRONG_ARGS
fi

CUST=$1
DATE=`date +%Y-%m-%d`
FILES=`grep -l ${DATE} ${CUST}/log/production*`

grep "Processing LoginController#login (for [0-9.]* at ${DATE} [0-9:]*) \[POST\]" ${FILES} > /tmp/fil
grep '.html' ${FILES} >> /tmp/fil
mail --subject=${CUST}_log.${DATE} $MAIL_ADDRESS < /tmp/fil
rm /tmp/fil

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to