diff options
Diffstat (limited to '')
-rw-r--r-- | test/formats/jsontest-subsec/format.json | 27 | ||||
-rw-r--r-- | test/formats/jsontest/format.json | 36 | ||||
-rw-r--r-- | test/formats/jsontest/lnav-logstash.json | 47 | ||||
-rw-r--r-- | test/formats/jsontest/rewrite-user.lnav | 2 | ||||
-rw-r--r-- | test/formats/jsontest2/format.json | 49 | ||||
-rw-r--r-- | test/formats/jsontest3/format.json | 75 |
6 files changed, 236 insertions, 0 deletions
diff --git a/test/formats/jsontest-subsec/format.json b/test/formats/jsontest-subsec/format.json new file mode 100644 index 0000000..8469c7f --- /dev/null +++ b/test/formats/jsontest-subsec/format.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://lnav.org/schemas/format-v1.schema.json", + "subsec_json_log": { + "title": "JSON Log with subsecond field", + "json": true, + "file-pattern": "logfile_json_subsec\\.json", + "line-format": [ + { + "field": "__timestamp__" + }, + " ", + { + "field": "msg" + } + ], + "timestamp-field": "instant/epochSecond", + "subsecond-field": "instant/nanoOfSecond", + "subsecond-units": "nano", + "body-field": "msg", + "value": { + "instant": { + "kind": "json", + "hidden": true + } + } + } +}
\ No newline at end of file diff --git a/test/formats/jsontest/format.json b/test/formats/jsontest/format.json new file mode 100644 index 0000000..78300e9 --- /dev/null +++ b/test/formats/jsontest/format.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://lnav.org/schemas/format-v1.schema.json", + "test_log" : { + "title" : "Test JSON Log", + "json" : true, + "file-pattern" : "logfile_json\\.json", + "description" : "Test config", + "line-format" : [ + "\n[", + { "field" : "ts" }, + "] ", + { "field" : "lvl" }, + " ", + { "field" : "msg" } + ], + "level-field" : "lvl", + "timestamp-field": "ts", + "body-field" : "msg", + "value" : { + "msg" : { + "rewriter" : ";SELECT :msg || 'bork bork bork'" + }, + "arr" : { + "kind" : "json" + }, + "obj" : { + "kind" : "json" + }, + "user" : { + "kind" : "string", + "identifier" : true, + "rewriter" : "|rewrite-user" + } + } + } +} diff --git a/test/formats/jsontest/lnav-logstash.json b/test/formats/jsontest/lnav-logstash.json new file mode 100644 index 0000000..27f9239 --- /dev/null +++ b/test/formats/jsontest/lnav-logstash.json @@ -0,0 +1,47 @@ +{ + "$schema": "https://lnav.org/schemas/format-v1.schema.json", + "logstash_dam": { + "title": "Logstash Java JSON", + "url": "https://github.com/logstash/logstash-logback-encoder", + "description": "Log format for DAM Logstash JSON", + "json": true, + "hide-extra": false, + "file-pattern": "\\.clog.*", + "multiline": false, + "line-format": [ + { "field" : "@timestamp" }, + " ", + { "field" : "ipaddress" }, + " ", + { "field" : "message" }, + " ", + { "field" : "stack_trace", "default-value" : "" } + ], + "timestamp-field" : "@timestamp", + "body-field" : "message", + "level-field" : "level", + "level" : { + "trace" : "TRACE", + "debug" : "DEBUG", + "info" : "INFO", + "error" : "ERROR", + "warning" : "WARN" + }, + "value" : { + "logger_name" : { + "kind" : "string", + "identifier" : true + }, + "ipaddress" : { + "kind" : "string", + "identifier" : true + }, + "level_value" : { + "hidden": true + }, + "stack_trace" : { + "kind" : "string" + } + } + } +} diff --git a/test/formats/jsontest/rewrite-user.lnav b/test/formats/jsontest/rewrite-user.lnav new file mode 100644 index 0000000..e34aa78 --- /dev/null +++ b/test/formats/jsontest/rewrite-user.lnav @@ -0,0 +1,2 @@ + +;SELECT 'mailto:' || :user diff --git a/test/formats/jsontest2/format.json b/test/formats/jsontest2/format.json new file mode 100644 index 0000000..167aa0f --- /dev/null +++ b/test/formats/jsontest2/format.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://lnav.org/schemas/format-v1.schema.json", + "json_log2": { + "title": "Test JSON Log with integer levels", + "json": true, + "file-pattern": "logfile_.*json2\\.json", + "description": "Test config", + "line-format": [ + { + "field": "ts" + }, + " ", + { + "field": "ts", + "timestamp-format": "abc %S def" + }, + " ", + { + "field": "lvl", + "min-width": 5 + }, + " ", + { + "field": "cl", + "max-width": 5 + }, + " ", + { + "field": "msg" + } + ], + "level-field": "lvl", + "level": { + "info": 0, + "error": 10 + }, + "timestamp-field": "ts", + "body-field": "msg", + "value": { + "user": { + "kind": "string", + "identifier": true + }, + "cl": { + "kind": "string" + } + } + } +} diff --git a/test/formats/jsontest3/format.json b/test/formats/jsontest3/format.json new file mode 100644 index 0000000..63cc2a6 --- /dev/null +++ b/test/formats/jsontest3/format.json @@ -0,0 +1,75 @@ +{ + "$schema": "https://lnav.org/schemas/format-v1.schema.json", + "json_log3": { + "title": "Test JSON Log Format", + "description": "Test JSON Log Format", + "file-pattern": "logfile_.*json3\\.json", + "json": true, + "hide-extra": true, + "convert-to-local-time": true, + "line-format": [ + { + "field": "__timestamp__" + }, + " ", + { + "field": "client_ip" + }, + " ", + { + "field": "request/method" + }, + " ", + { + "field": "response/status" + }, + " ", + { + "field": "request/uri" + } + ], + "value": { + "started_at": { + "kind": "integer", + "identifier": true + }, + "client_ip": { + "kind": "string", + "identifier": true + }, + "request/method": { + "kind": "string", + "identifier": true + }, + "request/uri": { + "kind": "string", + "identifier": true + }, + "request/size": { + "kind": "integer", + "identifier": false, + "hidden": true + }, + "response/status": { + "kind": "string" + }, + "details1": { + "hidden": true + }, + "details2": { + "hidden": true + }, + "details3": { + "hidden": true + } + }, + "timestamp-field": "started_at", + "timestamp-divisor": 1000, + "level-field": "response/status", + "level": { + "info": "2\\d+", + "warning": "4\\d+", + "critical": "5\\d+" + } + } +} |