I would like to parse my JSON log with jq, but my command didn't work anymore since few months.
I use tail from azure-cli command to show live log from my webapp
az webapp log tail --resource-group ${RESOURCE} --name ${appNAME} | sed 's/^[^{]*//g' | sed 's/[^}]*$//g' | jq -r .
I use roarr to parse log, but it's a detail
az webapp log tail --resource-group ${RESOURCE} --name ${appNAME} | sed 's/^[^{]*//g' | sed 's/[^}]*$//g' | roarr --exclude-alien true --use-colors --output-format pretty
Exemple of logs received by azure :
2021-09-08T19:04:34.555601536Z {"context":{"package":"slonik","poolId":"xynV9RGHSBewXN4hftNfaQ-0","logLevel":20,"processId":-140462480,"stats":{"idleConnectionCount":0,"totalConnectionCount":1,"waitingRequestCount":0}},"message":"client is checked out from the pool","sequence":648,"time":1631127874554,"version":"1.0.0"}
2021-09-08T19:04:34.561488913Z {"context":{"package":"slonik","poolId":"xynV9RGHSBewXN4hftNfaQ-0","logLevel":20,"processId":-140462480,"stats":{"idleConnectionCount":0,"totalConnectionCount":1,"waitingRequestCount":0}},"message":"client is checked out from the pool","sequence":649,"time":1631127874560,"version":"1.0.0"}
2021-09-08T19:04:34.567543092Z {"context":{"package":"slonik","poolId":"xynV9RGHSBewXN4hftNfaQ-0","logLevel":20,"processId":-140462480,"stats":{"idleConnectionCount":0,"totalConnectionCount":1,"waitingRequestCount":0}},"message":"client is checked out from the pool","sequence":650,"time":1631127874567,"version":"1.0.0"}
2021-09-08T19:04:34.815734729Z {"context":{"package":"slonik","poolId":"xynV9RGHSBewXN4hftNfaQ-0","logLevel":20,"processId":-140462480,"stats":{"idleConnectionCount":0,"totalConnectionCount":1,"waitingRequestCount":0}},"message":"client is checked out from the pool","sequence":651,"time":1631127874814,"version":"1.0.0"}
My expression clean the time header added by azure, but it's not working anymore
It look like there are no "\n" on log streamed by azure... or it like it's in one block, so impossible to parse JSON ...
Do you have any idea? How do you achieve that?