Skip to content

Instantly share code, notes, and snippets.

@Someguy123
Created September 15, 2018 00:17
Show Gist options
  • Save Someguy123/3abbf5ff4b0bb92f69e80f9b44117bc3 to your computer and use it in GitHub Desktop.
Save Someguy123/3abbf5ff4b0bb92f69e80f9b44117bc3 to your computer and use it in GitHub Desktop.
get timestamps on your steem docker logs
#!/bin/bash
# get timestamps on your steem docker logs
# by @someguy123
: ${DOCKER_NAME=seed}
LOG_PATH=$(docker inspect $DOCKER_NAME | jq -r .[0].LogPath)
pipe=/tmp/dkpipe.fifo
trap "rm -f $pipe" EXIT
if [[ ! -p $pipe ]]; then
mkfifo $pipe
fi
tail -f "$LOG_PATH" &> /tmp/dkpipe.fifo &
while true
do
if read line <$pipe; then
printf "$line" | jq -r ".time +\" \" + .log" | sed -e "s/\r//" | tr -s "\n"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment