Created
May 11, 2021 13:21
-
-
Save darrensapalo/d6eeaa1a6a07a2f98cce9c74adbf2e72 to your computer and use it in GitHub Desktop.
Preprocesses winston logs using fish string-replace CLI command
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
#! /usr/bin/fish | |
cp logs/review.log logs/raw.log | |
string replace -a '{"message":"' '' (cat logs/raw.log) > logs/raw.log | |
string replace -a '","level":"info","service":"dinein-cli"}' '' (cat logs/raw.log) > logs/raw.log | |
string replace -a '\"' '"' (cat logs/raw.log) > logs/raw.log | |
string replace -a -r "\\\\\\\\n" '\\n' (cat logs/raw.log) > logs/raw.log | |
string replace -a -r '\\\\n' '\\n' (cat logs/raw.log) > logs/raw.log | |
string replace -a -r '\\\\t' '' (cat logs/raw.log) > logs/reviewed.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment