Here’s a simple and customizable Python script to format JSON logs for readability. It takes raw JSON log lines (either from a file or standard input), parses them, and prints them in a human-readable format.
Features:
-
Supports reading from a file or standard input
-
Pretty-prints valid JSON with configurable indentation
-
Identifies and flags invalid JSON lines
-
Adds a visual separator for better readability
Usage:
-
Save it as
json_log_formatter.py -
Run from command line:
Let me know if you want an extended version with colorized output or filtering.
Share this Page your favorite way: Click any app below to share.