Created
February 24, 2015 16:52
-
-
Save LarsFronius/e579051d7f140fd803b0 to your computer and use it in GitHub Desktop.
If you ever want to debug a kinesis stream, copy this bash one liner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On a mac, `brew install awscli gnu-sed` before. | |
streamname=staging;aws kinesis describe-stream --stream-name $streamname --output text | grep SHARDS | awk '{print $2}' | while read shard; do aws kinesis get-shard-iterator --stream-name $streamname --shard-id $shard --shard-iterator-type LATEST --output text | while read iterator; do while output=`aws kinesis get-records --shard-iterator $iterator --output text`; do iterator=`echo "$output" | head -n1`; echo "$output" | gsed 1d | grep RECORDS | while read record; do echo $record | awk '{print $2}' | base64 -D; done; done; done; done |
We got a Unable to open 'd': No such file or directory
error, on Mac, and it looks like the base64
command works if you just use base64 -d
. Great script!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks guys, I used a combination of all your answers to get mine (ubuntu 18.04 | aws-cli/1.14.44 Python/3.6.5 Linux/4.15.0-36-generic botocore/1.8.48):
gsed 1d
forawk 'NR > 1'
base64 -D
forbase64 -id
Result: