How do you get realtime visitor stats in RoR?

I have found some projects as http://www.railstat.com/ but seem not
updated. I have used Google Analytics too, but it is not realtime and it
do not give some important information as IP address.

Juan K. wrote:

I have found some projects as http://www.railstat.com/ but seem not
updated. I have used Google Analytics too, but it is not realtime and it
do not give some important information as IP address.

I grab them out of the logs using a cron job which mails the results to
me.

Norm

Can you share the script that you use to parse the logs?

Norm S. wrote:

I grab them out of the logs using a cron job which mails the results to
me.

Juan K. wrote:

Can you share the script that you use to parse the logs?

Norm S. 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs