{ "$id": "https://lnav.org/schemas/format-v1.schema.json", "title": "https://lnav.org/schemas/format-v1.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "$schema": { "title": "/$schema", "description": "Specifies the type of this file", "type": "string" } }, "patternProperties": { "(\\w+)": { "description": "The definition of a log file format.", "title": "/", "type": "object", "properties": { "regex": { "description": "The set of regular expressions used to match log messages", "title": "//regex", "type": "object", "patternProperties": { "([^/]+)": { "description": "The set of patterns used to match log messages", "title": "//regex/", "type": "object", "properties": { "pattern": { "title": "//regex//pattern", "description": "The regular expression to match a log message and capture fields.", "type": "string", "minLength": 1 }, "module-format": { "title": "//regex//module-format", "description": "If true, this pattern will only be used to parse message bodies of container formats, like syslog", "type": "boolean" } }, "additionalProperties": false } }, "additionalProperties": false }, "json": { "title": "//json", "description": "Indicates that log files are JSON-encoded (deprecated, use \"file-type\": \"json\")", "type": "boolean" }, "convert-to-local-time": { "title": "//convert-to-local-time", "description": "Indicates that displayed timestamps should automatically be converted to local time", "type": "boolean" }, "hide-extra": { "title": "//hide-extra", "description": "Specifies whether extra values in JSON logs should be displayed", "type": "boolean" }, "multiline": { "title": "//multiline", "description": "Indicates that log messages can span multiple lines", "type": "boolean" }, "timestamp-divisor": { "title": "//timestamp-divisor", "description": "The value to divide a numeric timestamp by in a JSON log.", "type": [ "integer", "number" ] }, "file-pattern": { "title": "//file-pattern", "description": "A regular expression that restricts this format to log files with a matching name", "type": "string" }, "converter": { "description": "Describes how the file format can be detected and converted to a log that can be understood by lnav", "title": "//converter", "type": "object", "properties": { "type": { "title": "//converter/type", "description": "The MIME type", "type": "string" }, "header": { "description": "File header detection definitions", "title": "//converter/header", "type": "object", "properties": { "expr": { "description": "The expressions used to check if a file header matches this file format", "title": "//converter/header/expr", "type": "object", "patternProperties": { "(\\w+)": { "title": "//converter/header/expr/", "description": "SQLite expression", "type": "string" } }, "additionalProperties": false }, "size": { "title": "//converter/header/size", "description": "The minimum size required for this header type", "type": "integer" } }, "additionalProperties": false }, "command": { "title": "//converter/command", "description": "The script used to convert the file", "type": "string", "pattern": "[\\w\\.\\-]+" } }, "additionalProperties": false }, "level-field": { "title": "//level-field", "description": "The name of the level field in the log message pattern", "type": "string" }, "level-pointer": { "title": "//level-pointer", "description": "A regular-expression that matches the JSON-pointer of the level property", "type": "string" }, "timestamp-field": { "title": "//timestamp-field", "description": "The name of the timestamp field in the log message pattern", "type": "string" }, "subsecond-field": { "title": "//subsecond-field", "description": "The path to the property in a JSON-lines log message that contains the sub-second time value", "type": "string" }, "subsecond-units": { "title": "//subsecond-units", "description": "The units of the subsecond-field property value", "type": "string", "enum": [ "milli", "micro", "nano" ] }, "time-field": { "title": "//time-field", "description": "The name of the time field in the log message pattern. This field should only be specified if the timestamp field only contains a date.", "type": "string" }, "body-field": { "title": "//body-field", "description": "The name of the body field in the log message pattern", "type": "string" }, "url": { "title": "//url", "description": "A URL with more information about this log format", "type": [ "array", "string" ], "items": { "type": "string" } }, "title": { "title": "//title", "description": "The human-readable name for this log format", "type": "string" }, "description": { "title": "//description", "description": "A longer description of this log format", "type": "string" }, "timestamp-format": { "title": "//timestamp-format", "description": "An array of strptime(3)-like timestamp formats", "type": "array", "items": { "type": "string" } }, "module-field": { "title": "//module-field", "description": "The name of the module field in the log message pattern", "type": "string" }, "opid-field": { "title": "//opid-field", "description": "The name of the operation-id field in the log message pattern", "type": "string" }, "opid": { "description": "Definitions related to operations found in logs", "title": "//opid", "type": "object", "properties": { "subid": { "title": "//opid/subid", "description": "The field that holds the ID for a sub-operation", "type": "string" }, "description": { "description": "Define how to construct a description of an operation", "title": "//opid/description", "type": "object", "patternProperties": { "([\\w\\.\\-]+)": { "description": "A type of description for this operation", "title": "//opid/description/", "type": "object", "properties": { "format": { "description": "Defines the elements of this operation description", "title": "//opid/description//format", "type": "array", "items": { "type": "object", "properties": { "field": { "title": "//opid/description//format/field", "description": "The field to include in the operation description", "type": "string" }, "extractor": { "title": "//opid/description//format/extractor", "description": "The regex used to extract content for the operation description", "type": "string" }, "prefix": { "title": "//opid/description//format/prefix", "description": "A string to prepend to this field in the description", "type": "string" }, "suffix": { "title": "//opid/description//format/suffix", "description": "A string to append to this field in the description", "type": "string" }, "joiner": { "title": "//opid/description//format/joiner", "description": "A string to insert between instances of this field when the field is found more than once", "type": "string" } }, "additionalProperties": false } } }, "additionalProperties": false } }, "additionalProperties": false }, "sub-description": { "description": "Define how to construct a description of a sub-operation", "title": "//opid/sub-description", "type": "object", "patternProperties": { "([\\w\\.\\-]+)": { "description": "A type of description for this sub-operation", "title": "//opid/sub-description/", "type": "object", "properties": { "format": { "description": "Defines the elements of this operation description", "title": "//opid/sub-description//format", "type": "array", "items": { "type": "object", "properties": { "field": { "title": "//opid/sub-description//format/field", "description": "The field to include in the operation description", "type": "string" }, "extractor": { "title": "//opid/sub-description//format/extractor", "description": "The regex used to extract content for the operation description", "type": "string" }, "prefix": { "title": "//opid/sub-description//format/prefix", "description": "A string to prepend to this field in the description", "type": "string" }, "suffix": { "title": "//opid/sub-description//format/suffix", "description": "A string to append to this field in the description", "type": "string" }, "joiner": { "title": "//opid/sub-description//format/joiner", "description": "A string to insert between instances of this field when the field is found more than once", "type": "string" } }, "additionalProperties": false } } }, "additionalProperties": false } }, "additionalProperties": false } }, "additionalProperties": false }, "ordered-by-time": { "title": "//ordered-by-time", "description": "Indicates that the order of messages in the file is time-based.", "type": "boolean" }, "level": { "description": "The map of level names to patterns or integer values", "title": "//level", "type": "object", "patternProperties": { "(trace|debug[2345]?|info|stats|notice|warning|error|critical|fatal)": { "title": "//level/", "description": "The regular expression used to match the log text for this level. For JSON logs with numeric levels, this should be the number for the corresponding level.", "type": [ "integer", "string" ] } }, "additionalProperties": false }, "value": { "description": "The set of value definitions", "title": "//value", "type": "object", "patternProperties": { "([^/]+)": { "description": "The set of values captured by the log message patterns", "title": "//value/", "type": "object", "properties": { "kind": { "title": "//value//kind", "description": "The type of data in the field", "type": "string", "enum": [ "string", "integer", "float", "boolean", "json", "struct", "quoted", "xml" ] }, "collate": { "title": "//value//collate", "description": "The collating function to use for this column", "type": "string" }, "unit": { "description": "Unit definitions for this field", "title": "//value//unit", "type": "object", "properties": { "field": { "title": "//value//unit/field", "description": "The name of the field that contains the units for this field", "type": "string" }, "scaling-factor": { "description": "Transforms the numeric value by the given factor", "title": "//value//unit/scaling-factor", "type": "object", "patternProperties": { "([^/]+)": { "title": "//value//unit/scaling-factor/", "type": "object", "properties": { "op": { "title": "//value//unit/scaling-factor//op", "type": "string", "enum": [ "identity", "multiply", "divide" ] }, "value": { "title": "//value//unit/scaling-factor//value", "type": "number" } }, "additionalProperties": false } }, "additionalProperties": false } }, "additionalProperties": false }, "identifier": { "title": "//value//identifier", "description": "Indicates whether or not this field contains an identifier that should be highlighted", "type": "boolean" }, "foreign-key": { "title": "//value//foreign-key", "description": "Indicates whether or not this field should be treated as a foreign key for row in another table", "type": "boolean" }, "hidden": { "title": "//value//hidden", "description": "Indicates whether or not this field should be hidden", "type": "boolean" }, "action-list": { "title": "//value//action-list", "description": "Actions to execute when this field is clicked on", "type": "array", "items": { "type": "string" } }, "rewriter": { "title": "//value//rewriter", "description": "A command that will rewrite this field when pretty-printing", "type": "string", "examples": [ ";SELECT :sc_status || ' (' || (SELECT message FROM http_status_codes WHERE status = :sc_status) || ') '" ] }, "description": { "title": "//value//description", "description": "A description of the field", "type": "string" } }, "additionalProperties": false } }, "additionalProperties": false }, "tags": { "description": "The tags to automatically apply to log messages", "title": "//tags", "type": "object", "patternProperties": { "([\\w:;\\._\\-]+)": { "description": "The name of the tag to apply", "title": "//tags/", "type": "object", "properties": { "paths": { "description": "Restrict tagging to the given paths", "title": "//tags//paths", "type": "array", "items": { "type": "object", "properties": { "glob": { "title": "//tags//paths/glob", "description": "The glob to match against file paths", "type": "string", "examples": [ "*/system.log*" ] } }, "additionalProperties": false } }, "pattern": { "title": "//tags//pattern", "description": "The regular expression to match against the body of the log message", "type": "string", "examples": [ "\\w+ is down" ] }, "description": { "title": "//tags//description", "description": "A description of this tag", "type": "string" }, "level": { "title": "//tags//level", "description": "Constrain hits to log messages with this level", "type": "string", "enum": [ "trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal" ] } }, "additionalProperties": false } }, "additionalProperties": false }, "action": { "title": "//action", "type": "object", "patternProperties": { "(\\w+)": { "title": "//action/", "type": [ "string", "object" ], "properties": { "label": { "title": "//action//label", "type": "string" }, "capture-output": { "title": "//action//capture-output", "type": "boolean" }, "cmd": { "title": "//action//cmd", "type": "array", "items": { "type": "string" } } }, "additionalProperties": false } }, "additionalProperties": false }, "sample": { "description": "An array of sample log messages to be tested against the log message patterns", "title": "//sample", "type": "array", "items": { "type": "object", "properties": { "description": { "title": "//sample/description", "description": "A description of this sample.", "type": "string" }, "line": { "title": "//sample/line", "description": "A sample log line that should match a pattern in this format.", "type": "string" }, "level": { "title": "//sample/level", "description": "The expected level for this sample log line.", "type": "string", "enum": [ "trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal" ] } }, "additionalProperties": false } }, "line-format": { "description": "The display format for JSON-encoded log messages", "title": "//line-format", "type": "array", "items": { "type": [ "string", "object" ], "properties": { "field": { "title": "//line-format/field", "description": "The name of the field to substitute at this position", "type": "string" }, "default-value": { "title": "//line-format/default-value", "description": "The default value for this position if the field is null", "type": "string" }, "timestamp-format": { "title": "//line-format/timestamp-format", "description": "The strftime(3) format for this field", "type": "string", "minLength": 1 }, "min-width": { "title": "//line-format/min-width", "description": "The minimum width of the field", "type": "integer", "minimum": 0 }, "auto-width": { "title": "//line-format/auto-width", "description": "Automatically detect the necessary width of the field based on the observed values", "type": "boolean" }, "max-width": { "title": "//line-format/max-width", "description": "The maximum width of the field", "type": "integer", "minimum": 0 }, "align": { "title": "//line-format/align", "description": "Align the text in the column to the left or right side", "type": "string", "enum": [ "left", "right" ] }, "overflow": { "title": "//line-format/overflow", "description": "Overflow style", "type": "string", "enum": [ "abbrev", "truncate", "dot-dot" ] }, "text-transform": { "title": "//line-format/text-transform", "description": "Text transformation", "type": "string", "enum": [ "none", "uppercase", "lowercase", "capitalize" ] }, "prefix": { "title": "//line-format/prefix", "description": "Text to prepend to the value", "type": "string" }, "suffix": { "title": "//line-format/suffix", "description": "Text to append to the value", "type": "string" } }, "additionalProperties": false } }, "search-table": { "description": "Search tables to automatically define for this log format", "title": "//search-table", "type": "object", "patternProperties": { "(\\w+)": { "description": "The set of search tables to be automatically defined", "title": "//search-table/", "type": "object", "properties": { "pattern": { "title": "//search-table//pattern", "description": "The regular expression for this search table.", "type": "string" }, "glob": { "title": "//search-table//glob", "description": "Glob pattern used to constrain hits to messages that match the given pattern.", "type": "string" }, "level": { "title": "//search-table//level", "description": "Constrain hits to log messages with this level", "type": "string", "enum": [ "trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal" ] } }, "additionalProperties": false } }, "additionalProperties": false }, "highlights": { "description": "The set of highlight definitions", "title": "//highlights", "type": "object", "patternProperties": { "([^/]+)": { "description": "The definition of a highlight", "title": "//highlights/", "type": "object", "properties": { "pattern": { "title": "//highlights//pattern", "description": "A regular expression to highlight in logs of this format.", "type": "string" }, "color": { "title": "//highlights//color", "description": "The color to use when highlighting this pattern.", "type": "string" }, "background-color": { "title": "//highlights//background-color", "description": "The background color to use when highlighting this pattern.", "type": "string" }, "underline": { "title": "//highlights//underline", "description": "Highlight this pattern with an underline.", "type": "boolean" }, "blink": { "title": "//highlights//blink", "description": "Highlight this pattern by blinking.", "type": "boolean" } }, "additionalProperties": false } }, "additionalProperties": false }, "file-type": { "title": "//file-type", "description": "The type of file that contains the log messages", "type": "string", "enum": [ "text", "json", "csv" ] }, "max-unrecognized-lines": { "title": "//max-unrecognized-lines", "description": "The maximum number of lines in a file to use when detecting the format", "type": "integer", "minimum": 1 } }, "additionalProperties": false } }, "additionalProperties": false }