Logfmt Formatter
Format, validate, and convert key=value structured logs. Prettify dense Heroku and container logs, align them into a table, or turn them into JSON.
Formatted output will appear here.
About Logfmt Formatter
The Logfmt Formatter is a free online tool for cleaning up, validating, and converting logfmt — the structured logging format built from space-separated key=value pairs. Logfmt is the default log style on Heroku and is widely used by Go services, container runtimes, and command-line tools because it is readable by humans and easily parsed by machines.
Paste one or more log lines and the tool parses every record, then re-emits it the way you want: a Pretty single-line form with normalized spacing and quoting, an Expanded view with one field per line, an aligned Table across many records, or clean JSON with numbers and booleans detected automatically. Along the way it validates your logs, flagging unterminated quotes, stray equals signs, and duplicate keys.
Everything runs entirely in your browser, so even sensitive production logs never leave your device. Pair it with the JSON Viewer to explore the converted output.
How to Use Logfmt Formatter
- Paste your logfmt lines into the input box, or click Load Sample to try it. Each non-empty line is treated as one record.
- Choose an output mode — Pretty, Expanded, Table, or JSON.
- Toggle Sort keys to order fields alphabetically, Quote all values for strict quoting, or Detect types to coerce numbers and booleans in JSON.
- Check the validation banner below the panels for any warnings about malformed pairs.
- Click Copy to grab the formatted result.
Common Use Cases
Reading dense Heroku logs
Expand a long single-line router log into one field per line so status, method, path, and timing are easy to scan.
Converting logs to JSON
Turn key=value lines into a JSON array for ingestion into a script, a dashboard, or another tool.
Comparing many records
Use Table mode to align fields from dozens of log lines into columns and spot outliers at a glance.
Validating log output
Catch unterminated quotes and duplicate keys before they break your downstream log parser.
Normalizing inconsistent logs
Re-emit messy logs with consistent spacing, sorted keys, and uniform quoting.
Learning the logfmt format
See exactly how quoting, escaping, and boolean keys work by experimenting with live input and output.
Frequently Asked Questions
What is logfmt?
Logfmt is a structured logging format made of space-separated key=value pairs on a single line, such as level=info msg="server started" port=8080. It is human-readable like plain text yet machine-parseable like JSON, which is why it is popular with Heroku, Go services, and many CLI tools and container platforms.
How are values with spaces handled?
A value that contains a space, an equals sign, or a double quote must be wrapped in double quotes, for example msg="user logged in". Inside quotes, a literal double quote is escaped as \" and a backslash as \\. This formatter quotes values automatically when they need it, or for every value if you enable "Quote all values".
What does a key with no value mean?
A bare key like debug with no = is treated as a boolean flag — its presence means true. In JSON output it becomes "debug": true, and in logfmt output it is kept as a bare key.
What is the difference between Pretty, Expanded, and Table output?
Pretty re-emits each record as a single normalized logfmt line with consistent spacing and quoting. Expanded puts every key=value on its own line with a blank line between records, which is easier to read for dense logs. Table aligns the fields from many records into columns so you can scan them like a spreadsheet.
How does the validator detect problems?
As it parses, the tool flags common mistakes per line: an unterminated quoted value, a stray = with no key, and duplicate keys within the same record. Fix these and the warnings disappear, confirming your logs are well-formed.
Is my log data sent to a server?
No. All parsing, formatting, and conversion happen entirely in your browser. Your log lines never leave your device — nothing is uploaded or stored.