need help ksh scripting for log file

I have log files that contain data generated every 5 minutes.

I want to extract data from the log files to another log file

In each 5 minute series

<log4j:event logger="VistaMonitor" timestamp="1200688175425" time="Fri Jan 18 15:29:35 EST 2008"

Generated twice (I only to get the date once)

Further in the log file I need to extract from this line:

JMS: IntegrationFrameworkJMSServer.InboundQueue: 1,1,13479,13514,1,81700

I need the third value '13479' and last value '81700'

The script I was successful in putting together a script to tail the data but I want to extract the data one line per 5 min period
from a complete file.

Any suggestions would be helpful

Current Script:

#!/bin/ksh

MONITORLOG="/opt/bea/weblogic81/config/WebCTDomain/logs/webct_monitor.log"
LOG="/export/home/oracle/lmbct.log"

#DATE=`date +%m/%d/%Y-%H:%M`

WAIT=`grep " JMS: IntegrationFrameworkJMSServer.InboundQueue: " ${MONITORLOG} |t
ail -1 |cut -d',' -f 6`

DATE=`date +%m/%d/%Y-%H:%M`
HOSTNAME=`hostname`

echo "${DATE},${HOSTNAME},${WAIT}" >> ${LOG}

You can try to use a loop with the sleep command with a delay of 5 minutes:

#!/bin/ksh

MONITORLOG="/opt/bea/weblogic81/config/WebCTDomain/logs/webct_monitor.log"
LOG="/export/home/oracle/lmbct.log"
HOSTNAME=`hostname`

while :
do
  WAIT=`grep " JMS: IntegrationFrameworkJMSServer.InboundQueue: " ${MONITORLOG} |tail -1 |cut -d',' -f 6`
  DATE=`date +%m/%d/%Y-%H:%M`
  echo "${DATE},${HOSTNAME},${WAIT}" >> ${LOG}
  sleep 18000
done

Regards

Thanks for the quick reply. Yes, your script works great on the active log and my script above seems to capture the values every 5 minutes using crontab.

However, I have these huge monitor logs that have be rolled over and have not been captured by my new script. So, I have a 5 Gb log file filled with thousand
of logs generated every 5 minutes. I need to purge this file, take out the date from the log4j properties either from the real date or timestamp. This row:

<log4j:event logger="VistaMonitor" timestamp="1200688175425" time="Fri Jan 18 15:29:35 EST 2008"

then about 50 rows followng this date I need two values out of this line:

JMS: IntegrationFrameworkJMSServer.InboundQueue: 1,1,7405,10136,1,28506

I can't seem to capture the date: Jan 18 15:29 or the timestamp 1200688175425 and translate it. Then I can get one value - say 7405 but not both -

7405,28506

So, I have a huge log file and I need the following:

1/18/2008 15:29,7405,28506

and to have it print out all the dates and data for the whole file to a separate log file. Is it possible?
Thank you