Created
September 15, 2018 00:17
-
-
Save Someguy123/3abbf5ff4b0bb92f69e80f9b44117bc3 to your computer and use it in GitHub Desktop.
get timestamps on your steem docker logs
This file contains 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
#!/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