Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #!/bin/sh
  2. [ $1 ] || { echo "Usage: getxml <redacted-app-logfile>" ; exit 1 ; }
  3. [ -f $1 ] || { ls $1 ; exit 1 ; }
  4.  
  5. eventlog=$1
  6. #string specific to "baseline" version of the application
  7. string0="LoggerMessageProcessor - Outbound message before validation: "
  8. #string specific to new "test" version of the application
  9. string1="LoggerMessageProcessor - CustomerProfileEvent Message: "
  10.  
  11. baseline_events=`zgrep -m 1 "$string0" $eventlog|wc -l|awk '{print $1}'`
  12. parallel_events=`zgrep -m 1 "$string1" $eventlog|wc -l|awk '{print $1}'`
  13. if [ $baseline_events -gt 0 ] ; then
  14. matcher="$string0" ; tag="base"
  15. elif [ $parallel_events -gt 0 ] ; then
  16. matcher="$string1" ; tag="test"
  17. else
  18. echo "nothing to extract -- exiting" ; exit 1
  19. fi
  20. outputfile="$eventlog.$tag.$$.xml"
  21.  
  22. zgrep -e "$matcher" $eventlog | grep "\[INFO\]" \
  23. | awk -F"$matcher" 'NF>1 {print $2}' \
  24. | awk -F'ns3:BusinessEventId' '{print $1 FS substr($2,1,20) "....</" FS $3 }' \
  25. | awk -F'ns3:MessageTime' '{print $1 FS substr($2,1,11) "....</" FS $3 }' \
  26. | sort > $outputfile
  27.  
  28. echo "XML extracted to $outputfile"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement