#!/bin/bash
# update summary of most recent ESP logs
# First argument is the number of most recent logs to update.
#  if ommitted, write the summary of only the most recent ESP log.
#
#set -x
: ${logBase:=/LRAUV/Logs}
recent=${1--1}
for log in `ls -r $logBase/*/ESP.log | head $recent`; do
  summary=${log/.log}.sum
  egrep -h 'Selecting|Sampled|Error|Fail|Retry|Cmd::|Sampler::' $log >$summary
done
