본문으로 건너뛰기

jq 사용법

설치

sudo pacman -S jq

실시간 json log 파싱

For human-readable streaming logs, use jq to colorize JSON lines and pass non-JSON lines through unchanged. The sed stage expands escaped \n and \t sequences for readability.

alias log2jq="jq -rRC --unbuffered '. as \$line | try fromjson catch \$line' | sed -u 's/\\\\n/\\n/g; s/\\\\t/\\t/g'"
<program> | log2jq