You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:JsonLogs [file] - Open JSONL viewer (optional file path)
:JsonLogsGoto <line> - Jump to specific line number
:JsonLogsClose - Close the viewer
:JsonLogsStats - Show log statistics
:JsonLogsFilter --from <time> --to <time> - Filter by time range
:JsonLogsExport <file> - Export filtered logs
:JsonLogsTail - Toggle live tail mode
:JsonLogsTableColumns - Open column filter modal (table mode)
:JsonLogsJq '<filter>' - Apply jq filter
Configuration
require("jsonlogs").setup({
-- =============================================-- Basic Options-- =============================================-- Keybind prefix (used for some commands)prefix="<leader>jl",
-- Automatically open viewer when opening .jsonl filesauto_open=true,
-- =============================================-- Panel Layout-- =============================================layout= {
-- Preview panel position: "right" (vertical) or "bottom" (horizontal)position="right",
-- Preview panel width (for vertical split)width=80,
-- Preview panel height (for horizontal split)height=20,
},
-- =============================================-- JSON Formatting-- =============================================json= {
-- Indentation spaces for pretty-printed JSONindent=2,
-- Use jq CLI tool for formatting very large JSON objects (>10KB)use_jq_fallback=true,
-- Path to jq binary (if not in PATH)jq_path="jq",
},
-- =============================================-- Navigation-- =============================================navigation= {
-- Field name to check for error detection (e.g., "level", "severity")error_field="level",
-- Values that indicate an errorerror_values= { "error", "ERROR", "fatal", "FATAL" },
},
-- =============================================-- Display-- =============================================display= {
-- Show line numbers in preview buffershow_line_numbers=true,
-- Enable JSON syntax highlightingsyntax_highlighting=true,
-- Fields to show in compact modecompact_fields= { "timestamp", "level", "message" },
-- Maximum column width in table mode (cells are truncated with "..." if longer)table_max_col_width=30,
-- Placeholder text for null/missing values in table modetable_null_placeholder="-",
-- Number of entries per page in table mode (pagination)table_page_size=50,
},
-- =============================================-- Analysis-- =============================================analysis= {
-- Field name containing timestamps for time-range filteringtimestamp_field="timestamp",
-- Supported timestamp formats for parsingtimestamp_formats= {
"%Y-%m-%dT%H:%M:%S", -- ISO 8601 without timezone"%Y-%m-%d %H:%M:%S", -- Common database format"iso8601", -- Full ISO 8601 with timezone
},
},
-- =============================================-- Performance-- =============================================performance= {
-- Use jq for table formatting (faster for large files)-- Falls back to pure Lua if jq is not availableuse_jq_for_tables=true,
},
-- =============================================-- Advanced-- =============================================advanced= {
-- Update interval for tail mode in millisecondstail_update_interval=100,
-- Maximum character count for JSON pretty-print before using jq fallbackmax_preview_size=10000,
-- Show virtual text annotations (e.g., line info)virtual_text=true,
},
-- =============================================-- Streaming Mode (Large Files: 100MB-1GB)-- =============================================streaming= {
-- Enable streaming: true, false, or "auto"-- "auto" enables streaming for files larger than threshold_mbenabled="auto",
-- File size threshold in MB for auto-enabling streamingthreshold_mb=10,
-- Number of lines to load per chunkchunk_size=1000,
-- Maximum parsed JSON objects to keep in memorycache_size=100,
-- Sample size for discovering table columns (to avoid loading entire file)table_sample_size=1000,
-- Sample size for statistics calculationstats_sample_size=10000,
-- Show progress messages for long operationsshow_progress=true,
},
-- =============================================-- Keybindings-- =============================================keys= {
-- Navigationquit="q", -- Close viewernext_entry="j", -- Next log entryprev_entry="k", -- Previous log entryfirst_entry="gg", -- First entrylast_entry="G", -- Last entry-- Error Navigationnext_error="]e", -- Next error logprev_error="[e", -- Previous error log-- Preview Actionstoggle_fold="<CR>", -- Toggle fold in previewyank_json="y", -- Yank formatted JSON to clipboardswitch_pane="<Tab>", -- Toggle between source and preview panesmaximize_preview="f", -- Toggle preview panel maximize/restore-- Search & Filtersearch="/", -- Search by field value-- Bookmarksbookmark="m", -- Bookmark current linelist_bookmarks="'", -- List all bookmarks-- Display Modescompact_mode="c", -- Toggle compact viewtable_mode="T", -- Toggle table preview mode-- Table Mode Paginationtable_next_page="]", -- Next pagetable_prev_page="[", -- Previous pagetable_first_page="[[", -- First pagetable_last_page="]]", -- Last page-- Table Mode Featurestable_columns="C", -- Open column filter modalinspect_cell="<CR>", -- Inspect table cell (press in preview)-- Analysisdiff_view="d", -- Diff with marked linetail_mode="t", -- Toggle live tail modestats="s", -- Show log statistics
},
})
Configuration Notes
Streaming Mode: Automatically enabled for files >10MB. Loads data in chunks to avoid memory issues.
jq Integration: Requires jq to be installed. Falls back gracefully if unavailable.
Table Mode: Paginated view shows 50 entries per page by default. Use ]/[ to navigate pages.
Custom Keybindings: Override any key by setting it in the keys table.
π Table Preview Mode
Press T to view log entries as a spreadsheet-like markdown table:
| id | level | message | user.name | user.age | tags[0]| tags[1]| service ||----|-------|--------------------|-----------|----------|---------|---------|----------|| 1 | info | User logged in | Alice | 30 | vim | lua | auth || 2 | warn | Slow query detected| Bob | 25 | rust | - | database || 3 | error | Connection timeout | Carol | 35 | python | js | api |
Features:
Flattens nested objects (user.name, user.age)
Array indexing (tags[0], tags[1])
Interactive column filtering with C
Configurable column widths and null placeholders
Pagination for large files (50 entries per page by default)