HomeFormattersCodeLog File Formatter

Log File Formatter

Code

Format, clean, and filter log files in your browser. Normalises timestamps, highlights log levels, and filters by severity. No file upload — paste and process.

Formatted Logs

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

  1. 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.
  2. 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.
  3. Set Max Lines to control how many output lines are shown. The default is 1,000; increase it for larger logs.
  4. The Formatted Log output appears instantly. Review the normalised lines to confirm the timestamp and level parsing is correct.
  5. 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

A log file formatter parses raw log output and reformats it into a consistent, readable structure with aligned log levels, timestamps, and messages. It also lets you filter log lines by severity level so you can focus on errors and warnings without scrolling through thousands of info messages.
The formatter detects two common patterns: ISO timestamp followed by a log level and message (e.g. `2024-01-15T10:23:01Z INFO Server started`), and level-prefixed lines with or without brackets (e.g. `[ERROR] Connection refused` or `WARN: Disk usage high`). Plain lines that do not match are passed through if the filter level is 'all'.
You can filter to show all levels, or restrict to warnings and above (WARN, ERROR, FATAL), errors and above (ERROR, FATAL), or info and above (INFO, WARN, ERROR, FATAL). Filtering is inclusive — selecting 'Error and above' shows both ERROR and FATAL lines.
Max Lines limits how many formatted log lines appear in the output. This prevents the browser from slowing down when processing very large log files. Increase it if you are working with a large log and need to see more lines in one pass.
Not in the current version. The formatter handles plain-text log formats. JSON-structured logs (e.g. from Pino or Bunyan with `{"level":"info","msg":"started"}`) are passed through as plain text. Use the [JSON Formatter](/json-formatter/) to pretty-print individual JSON log lines.
Both are treated as the same severity level. Many logging frameworks use WARN (Log4j, Python logging) while others use WARNING (some Node.js and shell loggers). The formatter normalises both to [WARN] in the output so they sort and filter consistently.
No. All processing happens in your browser. Log files often contain IP addresses, usernames, and error stack traces — none of this is transmitted to a server. The formatter is safe for production log excerpts.
Yes. Docker and Kubernetes logs typically emit ISO-timestamped lines with INFO/WARN/ERROR prefixes. Paste the output of `docker logs <container>` or `kubectl logs <pod>` directly and the formatter parses and filters them.
Each line is normalised to a fixed format: timestamp (if present), a right-aligned 7-character level tag in brackets (e.g. `[ INFO]`, `[ WARN]`, `[ERROR]`), and the message. This alignment makes it easy to visually scan level distribution in a block of logs.
Unrecognised lines (stack traces, continuation lines, plain text interspersed in logs) are passed through unchanged when the filter level is set to 'all'. When a specific level filter is active, unrecognised lines are suppressed since their severity cannot be determined.
Yes — paste log output from multiple services into the same input field. Lines from different services interleave in the output in the order they appear. There is no service-name filtering in this formatter; if you need to split by source, separate the log excerpts first.
Also known as
log formatterlog file cleanerformat log outputfilter log levelslog viewer