Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- [ $1 ] || { echo "Usage: getxml <redacted-app-logfile>" ; exit 1 ; }
- [ -f $1 ] || { ls $1 ; exit 1 ; }
- eventlog=$1
- #string specific to "baseline" version of the application
- string0="LoggerMessageProcessor - Outbound message before validation: "
- #string specific to new "test" version of the application
- string1="LoggerMessageProcessor - CustomerProfileEvent Message: "
- baseline_events=`zgrep -m 1 "$string0" $eventlog|wc -l|awk '{print $1}'`
- parallel_events=`zgrep -m 1 "$string1" $eventlog|wc -l|awk '{print $1}'`
- if [ $baseline_events -gt 0 ] ; then
- matcher="$string0" ; tag="base"
- elif [ $parallel_events -gt 0 ] ; then
- matcher="$string1" ; tag="test"
- else
- echo "nothing to extract -- exiting" ; exit 1
- fi
- outputfile="$eventlog.$tag.$$.xml"
- zgrep -e "$matcher" $eventlog | grep "\[INFO\]" \
- | awk -F"$matcher" 'NF>1 {print $2}' \
- | awk -F'ns3:BusinessEventId' '{print $1 FS substr($2,1,20) "....</" FS $3 }' \
- | awk -F'ns3:MessageTime' '{print $1 FS substr($2,1,11) "....</" FS $3 }' \
- | sort > $outputfile
- echo "XML extracted to $outputfile"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement