Log File Formatter
CodeFormat, clean, and filter log files in your browser. Normalises timestamps, highlights log levels, and filters by severity. No file upload — paste and process.
What is a Log Formatter?
A log file formatter parses raw application log output and reformats it into a consistent, human-readable structure. Log files produced by different frameworks and services have wildly different formats: some prefix lines with ISO timestamps, some use bracketed level tags, some mix both, and some emit lines with no level at all. The formatter normalises all of these into a uniform layout so you can scan the log quickly and filter to only the severity levels you care about.
Every production application generates logs: web servers record request and response details, databases log slow queries, background workers log job status, and APIs log validation errors and dependency failures. During an incident, reading raw logs is one of the primary diagnostic activities. A poorly formatted log file — lines of varying length, inconsistent level tags, mixed timestamp formats — slows this process down. The formatter brings order to that chaos.
The tool is particularly useful when debugging Node.js, Python, Java, or Go application logs. It detects ISO-timestamped lines (the format used by most structured loggers), level-prefixed lines in the [LEVEL] message style, and colon-prefixed lines in the LEVEL: message style. Use it alongside the JSON Formatter for JSON-structured log lines, or the CSV Cleaner Formatter when logs are exported in CSV format.
How to use this Log Formatter calculator
- Paste your raw log output into the Log Input field. It can be output from a terminal, a log file download, or a log aggregator export.
- Set the Filter Level to the minimum severity you want to see. Select "All levels" for the full log, "Warn and above" to suppress info and debug noise, or "Error and above" for incident investigation.
- Set Max Lines to control how many output lines are shown. The default is 1,000; increase it for larger logs.
- The Formatted Log output appears instantly. Review the normalised lines to confirm the timestamp and level parsing is correct.
- Copy the formatted output to share in a bug report, postmortem, or Slack message.
Formula & Methodology
The formatter applies two pattern tests to each non-empty line: Pattern 1 — ISO timestamp:/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}(...) LEVEL message/Captures timestamp, level, and message separately. Pattern 2 — Level prefix:/^\[?LEVEL\]?\s*:?\s+message/Captures level and message; timestamp field is empty. Recognised levels: TRACE < DEBUG < INFO < WARN/WARNING < ERROR < FATAL/CRITICAL. The filter rank comparison excludes lines whose numeric rank is below the selected threshold. The output level tag is right-padded to a fixed 7-character width for alignment: | Level | Tag | |---|---| | TRACE |[TRACE]| | DEBUG |[DEBUG]| | INFO |[ INFO]| | WARN |[ WARN]| | ERROR |[ERROR]| | FATAL |[FATAL]| Unrecognised lines pass through unchanged when filter level is "all", and are suppressed otherwise.
Frequently Asked Questions