Last active
April 8, 2020 14:42
-
-
Save symbiont-eric-torreborre/7143bdc2c0d7b068df30f9f52fb3cbef to your computer and use it in GitHub Desktop.
Process log files
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
# find all txe log files from pod logs and copy them locally with an incrementing number | |
# 0.log, 1.log, 2.log, 3.log | |
# this uses: | |
# - https://github.com/sharkdp/fd (fast alternative to find) | |
# - https://github.com/BurntSushi/ripgrep (fast alternative to rg) | |
fd 0.log | rg txe | cat -n | while read n f; do cp -n "$f" "$n.log"; done | |
# extract the 'message' field from each log file and write it to txe-1.log, | |
# txe-2.log, txe-3.log, txe-4.log | |
for i in 1 2 3 4; do cat ~/Downloads/symbiont/logs/$i.log | jq '.log | fromjson | .message' > txe-$i.log; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment