Log viewer

A React component in Beamline's Data & tables category.

Log lines as they stream: it follows the newest line until you scroll up, then counts what arrived and brings you back in one click; filter by level with counts, search with every match marked and stepped through, wrap long lines, open a line's fields; only the lines in view are drawn, so a hundred thousand stay smooth.

Use it for

  • Output people read and search while it arrives: deploys, builds, jobs, a service's logs, an agent's tool output.
  • Large logs (thousands to hundreds of thousands of lines) that must stay smooth.

Not for

  • A history of who did what (timeline).
  • A short command's output shown once (code-block).
  • Structured records people sort and filter by column (data-grid).

Anatomy

  • toolbar: search with match count and previous / next, level chips with counts, Only matches, Wrap and Follow toggles, your actions
  • body: virtualised rows of line number, time, level (word and colour), source, message with marked matches
  • a line's fields opened under it
  • “N new lines” pill while you read above the tail
  • live mark while streaming

Variants

  • 0: levels shown (chips; all by default)
  • 1: wrap: one line each, or wrapped
  • 2: only matches: search filters instead of marking
  • 3: columns: line numbers and time on or off
  • 4: height: px or fill

States

  • loading (skeleton lines)
  • empty (says so, in your words)
  • streaming and following
  • reading above the tail (follow off, new lines counted)
  • searching (matches marked, current match outlined)
  • no matches
  • line opened (fields)
  • replay playhead (`playhead`: lines past it dim behind an accent line, out of the counts and the accessibility tree; they light up as it reaches them)

Keyboard

  • / focuses search; Enter and Shift+Enter step to the next and previous match; Escape clears it
  • In the log: ↑ ↓ move the current line, Page Up / Page Down by a screen, Home / End to the first and the newest (End follows again)
  • Enter opens or closes the current line's fields
  • Tab reaches line copy buttons; Enter copies the focused line without opening its fields or moving the active line.

Motion

New lines never animate (a feed that moves is unreadable); the view keeps pace with them only while following. The new-lines pill rises in once and its count rolls; a jump to a match glides the scroll (instant under reduced motion); an opened line's fields ease open. Nothing runs at rest.

Props

PropTypeDefaultDescription
lines (required)LogLine[]—Log records displayed in arrival order. Required.
follow / defaultFollow / onFollowChangeboolean—follow: Follows arriving log lines until the reader scrolls away; omit to use defaultFollow. defaultFollow: Initial follow-latest state when uncontrolled. Defaults to true. onFollowChange: Reports follow-latest state after a change; no callback by default.
wrap / defaultWrap / onWrapChangeboolean—wrap: Wraps long lines within the available width; omit to use defaultWrap. defaultWrap: Initial line wrapping when uncontrolled. Defaults to false. onWrapChange: Reports line wrapping after a change; no callback by default.
query / defaultQuery / onQueryChangestring—query: Controlled search or filter query; omit to use defaultQuery. defaultQuery: Initial query when uncontrolled. Defaults to an empty string. onQueryChange: Reports query after a change; no callback by default.
levels / defaultLevels / onLevelsChangeLogLevel[]—levels: Controlled visible log levels; omit to use defaultLevels. defaultLevels: Initially included levels; defaults to trace, debug, info, warn, error and fatal. onLevelsChange: Reports visible log levels after a change; no callback by default.
liveboolean—Marks the log as streaming.
heightnumber | "fill"—Default 360; "fill" takes the height its container gives it.
lineNumbers / timeboolean—lineNumbers: Shows a line number beside each log line. Defaults to true. time: Shows the timestamp beside each log line. Defaults to true.
formatTime(time: Date) => string—Formats a log timestamp as a Date; defaults to 24-hour hours, minutes, seconds and milliseconds.
actionsReactNode—Your controls at the toolbar's end (download, clear).
loadingboolean—Shows the loading state while data or an operation is pending. Defaults to false.
emptyLabelstring—Default "No log lines yet".
aria-label (required)string—The log's name: "Deploy #4821".
className / classNames / style / refstring / LogViewerClassNames / CSSProperties / Ref<HTMLDivElement>—className: Classes on the documented visual root; no override by default. classNames: Classes for the named visual parts; no part overrides by default. style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
followboolean—Follows arriving log lines until the reader scrolls away; omit to use defaultFollow.
defaultFollowboolean—Initial follow-latest state when uncontrolled. Defaults to true.
onFollowChange((follow: boolean) => void)—Reports follow-latest state after a change; no callback by default.
wrapboolean—Wraps long lines within the available width; omit to use defaultWrap.
defaultWrapboolean—Initial line wrapping when uncontrolled. Defaults to false.
onWrapChange((wrap: boolean) => void)—Reports line wrapping after a change; no callback by default.
querystring—Controlled search or filter query; omit to use defaultQuery.
defaultQuerystring—Initial query when uncontrolled. Defaults to an empty string.
onQueryChange((query: string) => void)—Reports query after a change; no callback by default.
levelsLogLevel[]—Controlled visible log levels; omit to use defaultLevels.
defaultLevelsLogLevel[]—Initially included levels; defaults to trace, debug, info, warn, error and fatal.
onLevelsChange((levels: LogLevel[]) => void)—Reports visible log levels after a change; no callback by default.
lineNumbersboolean—Shows a line number beside each log line. Defaults to true.
timeboolean—Shows the timestamp beside each log line. Defaults to true.
classNamestring—Classes on the documented visual root; no override by default.
classNamesPartial<Record<"root" | "body" | "row" | "toolbar" | "message" | "level" | "fields" | "…—Classes for the named visual parts; no part overrides by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
refRef<HTMLDivElement>—Receives the documented root element; no ref by default.
playheadnumber | null—With a replay: how many lines it has reached. Pass every line (the live value) as `lines` and `shown.length` from `useReplay` here while it is paused, held or replaying (null while live): the lines past the playhead stay in view, dim behind a playhead line, and light up as the replay reaches them; following keeps the playhead in view.

Built from

Dependencies

@tanstack/react-virtual, lucide-react

Import

import { LogViewer } from "@beamline/log-viewer";

Get it

Log viewer is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent

More in Data & tables

  • Living table: A table that shows as much as fits on both axes: width decides which columns show (the rest ride in the name line, moving there rather than vanishing)…
  • Availability layers: A week of bookable start times whose closed times explain themselves: every availability rule (hours, time off, bookings, buffers, rooms, lead time…
  • Capacity terrain: A schedule that stands on a terrain of capacity: under each station's lane of jobs, every day's load rises to its capacity line and an overload is a…
  • Domino move: A room board where one move shows its chain: drag a booking (or pick it and aim it with the keys) onto a taken room and the bookings it would push appear…
  • Match board: Month-end matching as one picture: bank lines and books entries side by side with threads between them — solid for matched, dashed with the host's reason…
  • Split anything: One splitter for money, quantities and time: a bar of the whole shows every target's part and what is not split yet; items are dragged onto targets…
  • Approval route: A policy you can read by trying it: an amount on a log scale with the thresholds as marks (the arrows stop just under, at and just over each), the…
  • Proposal twin: A proposal edited beside the client's exact page, the two linked both ways: a field in focus lights its twin on the page, scrolls it into view and joins…
  • Quantity river: The life of one order line's quantity: at rest a bar of its real split ("5 delivered · 1 back in stock · 1 damaged · 5 cancelled"), unfolding into a…
  • Stock horizon: Projected stock per item over the coming weeks: a strip of weeks with the safety line, weeks under safety in warn and short in danger, every dip said in…
  • Ageing queue: Tickets that visibly age: each ticket's ring fills toward its own service target and steps from on time to late to very late, the words say when it is…
  • Import lens: A messy import made fixable by kind: rows stream through the checks once with live counts; problems gather into groups that say what is wrong in words…
  • Duplicate guard: A new record that watches for the one that already exists: as you type, the likely duplicates slide in beside the form with the fields that match lit and…
  • Scan flow: A pick list that takes scans: each scan flies from the scan field into its row and fills that row's quantity ring, and the prompt moves to the next bin…
  • Pack planner: The packing bench: the order's items sit in box outlines drawn to scale, each box filling to its padding line, weighing against its limit and naming the…
  • Provenance lens: Hold Alt (or press Lens) over any number on the page and see what makes it: hairline threads draw from the number to the rows, cards and documents on…
  • Record time machine: The record itself, rewound in place: a slim track of every change (a tick per change in its person's colour, hollow for automation, named moments as…
  • Tension timeline: A plan where slack is something you see: every dependency is a string from one task's end to the next one's start, sagging with the days it has to spare…
  • Replay bar: Rewind for anything live: pause a stream, scrub back to the moment you missed (markers for the ones that matter), step one update at a time, replay at a…
  • Event calendar: A schedule of events by day, week or month: events that overlap sit side by side, drag one to another time or day or pull its bottom edge to change its…
  • Kanban board: Work as cards in columns by stage: drag a card (or lift it with Space and walk it with the arrows) to another column or place, the cards around it make…
  • Data grid: Virtualised local or server-driven grid: stable row IDs, manual sort and filters, pages or infinite loading, retry without losing rows, inline editing…
  • Pivot table: Records summed up by the fields people choose: rows grouped by one or more fields that fold open level by level, columns split by another, one or more…
  • Query builder: Conditions people build by hand to pick out records: each rule is a field, an operator that fits the field (contains, between, in the last N days, is any…
  • Sort order: Several sort keys in order. Each key says its rank in words ("Sort by Plan, A to Z", "then by Size, largest first") with its order named for the field's…
  • Metric rules: Ordered rules that colour a dashboard number. Each rule has a name for what its colour means ("At risk", not just red) and a tone (good, watch, act…
  • JSON viewer: A JSON value as a tree you can read and walk: branches open and close (one level, or all at once), closed ones preview what they hold, every value reads…
  • JSON diff viewer: Two versions of a JSON value compared as one tree: added keys marked +, removed ones struck through with −, changed values read old → new, unchanged keys…
  • Import mapping: Map the columns of a file to the fields of one record type, see what every value becomes, then run the import and get an outcome for each row…
  • Diff table: Proposed edits to a table before they happen: new rows green, removals struck through, changed cells old → new; each change can be left out and Apply…
  • Filter toolbar: The filters on a list kept in view: chips that remove themselves, Add filter with fields and their values, Clear all, and room for search or view controls.
  • Table: A native HTML table for small datasets, composed with children or driven by records; shared server paging, sorting, filters, search, stable-ID selection…

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.