check_forensic revision 61b783ccb1ca514d1d310b840d9adaf23f85280b
46ef178b8f55b794c65491b370974833ce9e621bben#!/bin/sh
46ef178b8f55b794c65491b370974833ce9e621bben
46ef178b8f55b794c65491b370974833ce9e621bben# check_forensic <forensic log file>
46ef178b8f55b794c65491b370974833ce9e621bben
46ef178b8f55b794c65491b370974833ce9e621bben# check the forensic log for requests that did not complete
46ef178b8f55b794c65491b370974833ce9e621bben# output the request log for each one
46ef178b8f55b794c65491b370974833ce9e621bben
46ef178b8f55b794c65491b370974833ce9e621bbenF=$1
46ef178b8f55b794c65491b370974833ce9e621bben
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantztemp_create_method=file
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzif test -f `which mktemp`; then
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz temp_create_method=mktemp
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzelif test -f `which tempfile`; then
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz temp_create_method=tempfile
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzfi
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzcreate_temp()
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz{
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz prefix=$1
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz case "$temp_create_method" in
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz file)
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz name="/tmp/$1.$$"
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz ;;
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz mktemp)
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz name=`mktemp -t $1.XXXXXX`
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz ;;
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz tempfile)
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz name=`tempfile --prefix=$1`
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz ;;
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz *)
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz echo "$0: Cannot create temporary file"
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz exit 1
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz ;;
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz esac
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz}
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantz
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzcreate_temp fcall
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzall=$name
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzcreate_temp fcin
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzin=$name
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzcreate_temp fcout
61b783ccb1ca514d1d310b840d9adaf23f85280bjerenkrantzout=$name
06106b6b63b112a09de1b66fa29596035c0176ffthommaytrap "rm -f -- \"$all\" \"$in\" \"$out\";" 0 1 2 3 13 15
06106b6b63b112a09de1b66fa29596035c0176ffthommay
06106b6b63b112a09de1b66fa29596035c0176ffthommaycut -f 1 -d '|' $F > $all
06106b6b63b112a09de1b66fa29596035c0176ffthommaygrep + < $all | cut -c2- | sort > $in
06106b6b63b112a09de1b66fa29596035c0176ffthommaygrep -- - < $all | cut -c2- | sort > $out
06106b6b63b112a09de1b66fa29596035c0176ffthommay
01a7e88ee22138b225a4d5f42094b46ac8b1304cben# use -i instead of -I for GNU xargs
06106b6b63b112a09de1b66fa29596035c0176ffthommayjoin -v 1 $in $out | xargs -I xx egrep "^\\+xx" $F
06106b6b63b112a09de1b66fa29596035c0176ffthommayexit 0