summaryrefslogtreecommitdiffstats
path: root/docs/schemas/format-v1.schema.json
blob: 7403379836174b768b5edbf8701ab9342e3ffc60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
{
    "$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": "/<format_name>",
            "type": "object",
            "properties": {
                "regex": {
                    "description": "The set of regular expressions used to match log messages",
                    "title": "/<format_name>/regex",
                    "type": "object",
                    "patternProperties": {
                        "([^/]+)": {
                            "description": "The set of patterns used to match log messages",
                            "title": "/<format_name>/regex/<pattern_name>",
                            "type": "object",
                            "properties": {
                                "pattern": {
                                    "title": "/<format_name>/regex/<pattern_name>/pattern",
                                    "description": "The regular expression to match a log message and capture fields.",
                                    "type": "string",
                                    "minLength": 1
                                },
                                "module-format": {
                                    "title": "/<format_name>/regex/<pattern_name>/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": "/<format_name>/json",
                    "description": "Indicates that log files are JSON-encoded (deprecated, use \"file-type\": \"json\")",
                    "type": "boolean"
                },
                "convert-to-local-time": {
                    "title": "/<format_name>/convert-to-local-time",
                    "description": "Indicates that displayed timestamps should automatically be converted to local time",
                    "type": "boolean"
                },
                "hide-extra": {
                    "title": "/<format_name>/hide-extra",
                    "description": "Specifies whether extra values in JSON logs should be displayed",
                    "type": "boolean"
                },
                "multiline": {
                    "title": "/<format_name>/multiline",
                    "description": "Indicates that log messages can span multiple lines",
                    "type": "boolean"
                },
                "timestamp-divisor": {
                    "title": "/<format_name>/timestamp-divisor",
                    "description": "The value to divide a numeric timestamp by in a JSON log.",
                    "type": [
                        "integer",
                        "number"
                    ]
                },
                "file-pattern": {
                    "title": "/<format_name>/file-pattern",
                    "description": "A regular expression that restricts this format to log files with a matching name",
                    "type": "string"
                },
                "mime-types": {
                    "title": "/<format_name>/mime-types",
                    "description": "A list of mime-types this format should be used for",
                    "type": "array",
                    "items": {
                        "type": "string",
                        "enum": [
                            "application/vnd.tcpdump.pcap"
                        ]
                    }
                },
                "level-field": {
                    "title": "/<format_name>/level-field",
                    "description": "The name of the level field in the log message pattern",
                    "type": "string"
                },
                "level-pointer": {
                    "title": "/<format_name>/level-pointer",
                    "description": "A regular-expression that matches the JSON-pointer of the level property",
                    "type": "string"
                },
                "timestamp-field": {
                    "title": "/<format_name>/timestamp-field",
                    "description": "The name of the timestamp field in the log message pattern",
                    "type": "string"
                },
                "subsecond-field": {
                    "title": "/<format_name>/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": "/<format_name>/subsecond-units",
                    "description": "The units of the subsecond-field property value",
                    "type": "string",
                    "enum": [
                        "milli",
                        "micro",
                        "nano"
                    ]
                },
                "time-field": {
                    "title": "/<format_name>/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": "/<format_name>/body-field",
                    "description": "The name of the body field in the log message pattern",
                    "type": "string"
                },
                "url": {
                    "title": "/<format_name>/url",
                    "description": "A URL with more information about this log format",
                    "type": [
                        "array",
                        "string"
                    ],
                    "items": {
                        "type": "string"
                    }
                },
                "title": {
                    "title": "/<format_name>/title",
                    "description": "The human-readable name for this log format",
                    "type": "string"
                },
                "description": {
                    "title": "/<format_name>/description",
                    "description": "A longer description of this log format",
                    "type": "string"
                },
                "timestamp-format": {
                    "title": "/<format_name>/timestamp-format",
                    "description": "An array of strptime(3)-like timestamp formats",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "module-field": {
                    "title": "/<format_name>/module-field",
                    "description": "The name of the module field in the log message pattern",
                    "type": "string"
                },
                "opid-field": {
                    "title": "/<format_name>/opid-field",
                    "description": "The name of the operation-id field in the log message pattern",
                    "type": "string"
                },
                "ordered-by-time": {
                    "title": "/<format_name>/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": "/<format_name>/level",
                    "type": "object",
                    "patternProperties": {
                        "(trace|debug[2345]?|info|stats|notice|warning|error|critical|fatal)": {
                            "title": "/<format_name>/level/<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": "/<format_name>/value",
                    "type": "object",
                    "patternProperties": {
                        "([^/]+)": {
                            "description": "The set of values captured by the log message patterns",
                            "title": "/<format_name>/value/<value_name>",
                            "type": "object",
                            "properties": {
                                "kind": {
                                    "title": "/<format_name>/value/<value_name>/kind",
                                    "description": "The type of data in the field",
                                    "type": "string",
                                    "enum": [
                                        "string",
                                        "integer",
                                        "float",
                                        "boolean",
                                        "json",
                                        "struct",
                                        "quoted",
                                        "xml"
                                    ]
                                },
                                "collate": {
                                    "title": "/<format_name>/value/<value_name>/collate",
                                    "description": "The collating function to use for this column",
                                    "type": "string"
                                },
                                "unit": {
                                    "description": "Unit definitions for this field",
                                    "title": "/<format_name>/value/<value_name>/unit",
                                    "type": "object",
                                    "properties": {
                                        "field": {
                                            "title": "/<format_name>/value/<value_name>/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": "/<format_name>/value/<value_name>/unit/scaling-factor",
                                            "type": "object",
                                            "patternProperties": {
                                                "([^/]+)": {
                                                    "title": "/<format_name>/value/<value_name>/unit/scaling-factor/<scale>",
                                                    "type": "object",
                                                    "properties": {
                                                        "op": {
                                                            "title": "/<format_name>/value/<value_name>/unit/scaling-factor/<scale>/op",
                                                            "type": "string",
                                                            "enum": [
                                                                "identity",
                                                                "multiply",
                                                                "divide"
                                                            ]
                                                        },
                                                        "value": {
                                                            "title": "/<format_name>/value/<value_name>/unit/scaling-factor/<scale>/value",
                                                            "type": "number"
                                                        }
                                                    },
                                                    "additionalProperties": false
                                                }
                                            },
                                            "additionalProperties": false
                                        }
                                    },
                                    "additionalProperties": false
                                },
                                "identifier": {
                                    "title": "/<format_name>/value/<value_name>/identifier",
                                    "description": "Indicates whether or not this field contains an identifier that should be highlighted",
                                    "type": "boolean"
                                },
                                "foreign-key": {
                                    "title": "/<format_name>/value/<value_name>/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": "/<format_name>/value/<value_name>/hidden",
                                    "description": "Indicates whether or not this field should be hidden",
                                    "type": "boolean"
                                },
                                "action-list": {
                                    "title": "/<format_name>/value/<value_name>/action-list",
                                    "description": "Actions to execute when this field is clicked on",
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "rewriter": {
                                    "title": "/<format_name>/value/<value_name>/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": "/<format_name>/value/<value_name>/description",
                                    "description": "A description of the field",
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false
                        }
                    },
                    "additionalProperties": false
                },
                "tags": {
                    "description": "The tags to automatically apply to log messages",
                    "title": "/<format_name>/tags",
                    "type": "object",
                    "patternProperties": {
                        "([\\w:;\\._\\-]+)": {
                            "description": "The name of the tag to apply",
                            "title": "/<format_name>/tags/<tag_name>",
                            "type": "object",
                            "properties": {
                                "paths": {
                                    "description": "Restrict tagging to the given paths",
                                    "title": "/<format_name>/tags/<tag_name>/paths",
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "glob": {
                                                "title": "/<format_name>/tags/<tag_name>/paths/glob",
                                                "description": "The glob to match against file paths",
                                                "type": "string",
                                                "examples": [
                                                    "*/system.log*"
                                                ]
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                },
                                "pattern": {
                                    "title": "/<format_name>/tags/<tag_name>/pattern",
                                    "description": "The regular expression to match against the body of the log message",
                                    "type": "string",
                                    "examples": [
                                        "\\w+ is down"
                                    ]
                                },
                                "description": {
                                    "title": "/<format_name>/tags/<tag_name>/description",
                                    "description": "A description of this tag",
                                    "type": "string"
                                },
                                "level": {
                                    "title": "/<format_name>/tags/<tag_name>/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": "/<format_name>/action",
                    "type": "object",
                    "patternProperties": {
                        "(\\w+)": {
                            "title": "/<format_name>/action/<action_name>",
                            "type": [
                                "string",
                                "object"
                            ],
                            "properties": {
                                "label": {
                                    "title": "/<format_name>/action/<action_name>/label",
                                    "type": "string"
                                },
                                "capture-output": {
                                    "title": "/<format_name>/action/<action_name>/capture-output",
                                    "type": "boolean"
                                },
                                "cmd": {
                                    "title": "/<format_name>/action/<action_name>/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": "/<format_name>/sample",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "description": {
                                "title": "/<format_name>/sample/description",
                                "description": "A description of this sample.",
                                "type": "string"
                            },
                            "line": {
                                "title": "/<format_name>/sample/line",
                                "description": "A sample log line that should match a pattern in this format.",
                                "type": "string"
                            },
                            "level": {
                                "title": "/<format_name>/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": "/<format_name>/line-format",
                    "type": "array",
                    "items": {
                        "type": [
                            "string",
                            "object"
                        ],
                        "properties": {
                            "field": {
                                "title": "/<format_name>/line-format/field",
                                "description": "The name of the field to substitute at this position",
                                "type": "string"
                            },
                            "default-value": {
                                "title": "/<format_name>/line-format/default-value",
                                "description": "The default value for this position if the field is null",
                                "type": "string"
                            },
                            "timestamp-format": {
                                "title": "/<format_name>/line-format/timestamp-format",
                                "description": "The strftime(3) format for this field",
                                "type": "string",
                                "minLength": 1
                            },
                            "min-width": {
                                "title": "/<format_name>/line-format/min-width",
                                "description": "The minimum width of the field",
                                "type": "integer",
                                "minimum": 0
                            },
                            "max-width": {
                                "title": "/<format_name>/line-format/max-width",
                                "description": "The maximum width of the field",
                                "type": "integer",
                                "minimum": 0
                            },
                            "align": {
                                "title": "/<format_name>/line-format/align",
                                "description": "Align the text in the column to the left or right side",
                                "type": "string",
                                "enum": [
                                    "left",
                                    "right"
                                ]
                            },
                            "overflow": {
                                "title": "/<format_name>/line-format/overflow",
                                "description": "Overflow style",
                                "type": "string",
                                "enum": [
                                    "abbrev",
                                    "truncate",
                                    "dot-dot"
                                ]
                            },
                            "text-transform": {
                                "title": "/<format_name>/line-format/text-transform",
                                "description": "Text transformation",
                                "type": "string",
                                "enum": [
                                    "none",
                                    "uppercase",
                                    "lowercase",
                                    "capitalize"
                                ]
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "search-table": {
                    "description": "Search tables to automatically define for this log format",
                    "title": "/<format_name>/search-table",
                    "type": "object",
                    "patternProperties": {
                        "(\\w+)": {
                            "description": "The set of search tables to be automatically defined",
                            "title": "/<format_name>/search-table/<table_name>",
                            "type": "object",
                            "properties": {
                                "pattern": {
                                    "title": "/<format_name>/search-table/<table_name>/pattern",
                                    "description": "The regular expression for this search table.",
                                    "type": "string"
                                },
                                "glob": {
                                    "title": "/<format_name>/search-table/<table_name>/glob",
                                    "description": "Glob pattern used to constrain hits to messages that match the given pattern.",
                                    "type": "string"
                                },
                                "level": {
                                    "title": "/<format_name>/search-table/<table_name>/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": "/<format_name>/highlights",
                    "type": "object",
                    "patternProperties": {
                        "([^/]+)": {
                            "description": "The definition of a highlight",
                            "title": "/<format_name>/highlights/<highlight_name>",
                            "type": "object",
                            "properties": {
                                "pattern": {
                                    "title": "/<format_name>/highlights/<highlight_name>/pattern",
                                    "description": "A regular expression to highlight in logs of this format.",
                                    "type": "string"
                                },
                                "color": {
                                    "title": "/<format_name>/highlights/<highlight_name>/color",
                                    "description": "The color to use when highlighting this pattern.",
                                    "type": "string"
                                },
                                "background-color": {
                                    "title": "/<format_name>/highlights/<highlight_name>/background-color",
                                    "description": "The background color to use when highlighting this pattern.",
                                    "type": "string"
                                },
                                "underline": {
                                    "title": "/<format_name>/highlights/<highlight_name>/underline",
                                    "description": "Highlight this pattern with an underline.",
                                    "type": "boolean"
                                },
                                "blink": {
                                    "title": "/<format_name>/highlights/<highlight_name>/blink",
                                    "description": "Highlight this pattern by blinking.",
                                    "type": "boolean"
                                }
                            },
                            "additionalProperties": false
                        }
                    },
                    "additionalProperties": false
                },
                "file-type": {
                    "title": "/<format_name>/file-type",
                    "description": "The type of file that contains the log messages",
                    "type": "string",
                    "enum": [
                        "text",
                        "json",
                        "csv"
                    ]
                },
                "max-unrecognized-lines": {
                    "title": "/<format_name>/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
}