Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- export AWS_PROFILE=default
- FULLPATH="s3://jayers99-flowlog-test/AWSLogs/441655563487/vpcflowlogs/"
- BUCKET=$(echo "$FULLPATH" | cut -d "/" -f3)
- echo "#$BUCKET#";
- echo ;
- LASTFILES=$(aws s3 ls $FULLPATH --recursive | sort | tail -n 10 | awk '{print $4}')
- rm ./lastfile
- for i in $LASTFILES; do
- if [ ! -f ./lastfile$i ]; then
- aws s3 cp s3://$BUCKET/$i ./lastfile$i
- fi
- gunzip -c ./lastfile$i >> ./lastfile
- done
- cat ./lastfile | ggrep -P '^((?!version|NODATA).)*$' | awk '{ cmd="date -r "$11" +%Y-%m-%dT%H:%M:%S"; cmd | getline myTime; close(cmd); printf "%s %-15s %-15s\n", myTime, $4, $5 }' | sort
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement