I´ve playing for a whilen and resarching but I´m not able to find a solution. I have some huge logs, where sometimes there are also huge JSONS. But to simplify imagine the following:
mkdir logs
cd logs/
echo "$(date) [INFO] something" >> huge_log.log
echo "$(date) [INFO] something more" >> huge_log.log
echo "$(date) [INFO] Something with json: {\"foo\": \"bar\"}" >> huge_log.log
tail -n 5 -f huge_log.log | how_to_filter? | jq '.'
Is it possible to be able to see something like this (the json as the output of jq '.' would be):
Tue Aug 18 12:42:24 CEST 2020 [INFO] something
Tue Aug 18 12:42:29 CEST 2020 [INFO] something more
Tue Aug 18 12:43:05 CEST 2020 [INFO] Something with json:
{
"foo": "bar"
}
So, somehow, automatically detect the jsons while printing the log and show them as the output would be for:
echo "{\"foo\": \"bar\"}" | jq '.'
{
"foo": "bar"
}