Skip to content

Instantly share code, notes, and snippets.

@ashwanthkumar
Last active February 12, 2016 10:11
Show Gist options
  • Save ashwanthkumar/38a2a6ae541d1715af51 to your computer and use it in GitHub Desktop.
Save ashwanthkumar/38a2a6ae541d1715af51 to your computer and use it in GitHub Desktop.
#!/bin/bash
PACKER_LOG_FILE=$1
while read LINE; do
BUILDER_NAME=$(echo $LINE | awk -F, '{print $2}')
if [ "X$BUILDER_NAME" != "X" ]; then
echo "found $BUILDER_NAME on $LINE"
fi
done < $PACKER_LOG_FILE
brindavan:~ ashwanthkumar$ time ./parse-packer packer.log
found hvm-builder on 1455261963,hvm-builder,artifact-count,1
found hvm-builder on 1455261964,hvm-builder,artifact,0,builder-id,mitchellh.amazonebs
found hvm-builder on 1455261964,hvm-builder,artifact,0,id,us-east-1:ami-abcd
found hvm-builder on 1455261964,hvm-builder,artifact,0,string,AMIs were created:nnus-east-1: ami-abcd
found hvm-builder on 1455261964,hvm-builder,artifact,0,files-count,0
found hvm-builder on 1455261964,hvm-builder,artifact,0,end
found pvm-builder on 1455261964,pvm-builder,artifact-count,1
found pvm-builder on 1455261964,pvm-builder,artifact,0,builder-id,mitchellh.amazonebs
found pvm-builder on 1455261964,pvm-builder,artifact,0,id,us-east-1:ami-efgh
found pvm-builder on 1455261964,pvm-builder,artifact,0,string,AMIs were created:nnus-east-1: ami-efgh
found pvm-builder on 1455261964,pvm-builder,artifact,0,files-count,0
found pvm-builder on 1455261964,pvm-builder,artifact,0,end
real 0m6.265s
user 0m2.829s
sys 0m4.118s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment