Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for new log formats #1286

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions src/formats/gitea_log.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"gitea_log": {
"title": "Gitea",
"description": "The format used by the Gitea code forge. Default format is documented as the value of the `stdflags` flag.",
"url": "https://docs.gitea.com/administration/logging-configuration#flags",
"multiline": true,
"regex": {
"std": {
"pattern": "^(\\^.*m)?(?<timestamp>\\d{4}\/\\d{2}\/\\d{2} \\d{2}:\\d{2}:\\d{2}) (?<component>(\\^.*m)?.*(\\^.*m)?) (\\^.*m)?\\[(?<level>\\w+)](\\^.*m)? (?<body>.*)?$"
}
},
"value": {
"component": {
"kind": "string",
"identifier": true
}
},
"level": {
"critical": "^C(RITICAL)?",
"error": "^E(RROR)?",
"warning": "^W(ARNING)?",
"info": "^I(NFO)?",
"debug": "^D(EBUG)?",
"trace": "^T(RACE)?"
},
"sample": [
{
"line": "2023/09/24 22:15:55 cmd/web.go:223:runWeb() [I] Starting Gitea on PID: 7",
"level": "info"
},
{
"line": "2023/09/24 22:16:01 routers/common/db.go:21:InitDBEngine() [INFO] Beginning ORM engine initialization.",
"level": "info"
},
{
"line": "2023/10/08 22:09:10 ...eb/routing/logger.go:68:func1() [I] router: polling GET /user/events for 192.168.1.30:0, elapsed 3800.5ms @ events/events.go:18(events.Events)",
"level": "info"
},
{
"line": "2023/10/08 16:06:57 ...irror/mirror_pull.go:170:parseRemoteUpdateOutput() [W] parseRemoteUpdateOutput: unexpected update line \" * [new ref] refs/pull/1319/merge -> refs/pull/1319/merge\"",
"level": "warning"
},
{
"line": "2023/10/08 02:37:48 ...eb/routing/logger.go:68:func1() [WARNING] router: slow POST /user/login for 192.168.56.20:0, elapsed 3362.5ms @ auth/auth.go:170(auth.SignInPost)",
"level": "warning"
},
{
"line": "^[[36m2023/09/24 22:16:01 ^[[0m^[[32mcmd/web.go:175:^[[32mserveInstalled()^[[0m ^[[1;32m[I]^[[0m PING DATABASE mysql",
"level": "info"
// log line stored with terminal color codes
}
]
}
}
56 changes: 56 additions & 0 deletions src/formats/i2p_router_log.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"i2p_router_log": {
"title": "I2P Router logs",
"description": "The format used by the original I2P Router.",
"url": "https://geti2p.net/",
"multiline": true,
"regex": {
"std": {
"pattern": "^(?J:(?:(?<timestamp>\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d+) (?:(?<level>[A-Z]+) \\[(?<module>[\\w \\/]+)\\] (?<component>[\\w.]+): (?<body>.*)|(?:(?:\\^){3} \\d+ similar messages omitted (?:\\^){3})))|(?:(?:(?:[\\w.]+(?<level>Exception):)|(?:\\\tat)) .*)|(?:(?:\\*{3} .*)|(?:Starting I2P.*)|(?:\\[startapp].*)))$"
// The I2P router uses several log line variants that largely differ in their formats.
// Editing a variant should be done below in subformats for better readability and understandability,
// and then merged into the pattern above.
// subformats:
// "variant_normal": "^(?<timestamp>\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d+) (?<level>[A-Z]+) \\[(?<module>[\\w \\\/]+)\\] (?<component>[\\w.]+): (?<body>.*)$"
// "variant_omit": "^(?<timestamp>\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d+) (?:\\^){3} \\d+ similar messages omitted (?:\\^){3}$"
// "variant_exception": "^(?:(?:(?:[\\w.]+(?<level>Exception):)|(?:\\\\0009at)) .*)$"
// "variant_startup_lines": "^(?:(?:\*{3} .*)|(?:Starting I2P.*)|(?:\[startapp].*))$"
}
},
"value": {
"component": {
"kind": "string",
"identifier": true
}
},
"level": {
"critical": "^CRIT",
"error": "^(ERROR)|(Exception)",
"warning": "^WARN",
"info": "^INFO",
"debug": "^DEBUG"
},
"sample": [
{
"line": "2023-10-25 03:33:41.702 WARN [ handler 1/1] er.transport.udp.PacketHandler: Migrated 91 byte packet from 11.111.111.111:22222 for 11.11.111.111:22222 nTyr4s IB2 recvAge: 60ms sendAge: 3m sendAttemptAge: 60ms sendACKAge: 60ms lifetime: 4m RTT: 60 RTTdev: 16 RTO: 60000 MTU: 1280 LMTU: 1484 cwin: 1500 acwin: 1771 SST: 2560 FRTX? false consecFail: 0 msgs rcvd: 3 msgs sent: 3 pkts rcvd OK/Dup: 7933/0 pkts sent OK/Dup: 3/0 IBM: 0 OBQ: 0 OBL: 0\\n",
"level": "warning"
},
{
"line": "2023-10-25 03:33:41.764 WARN [ handler 1/1] outer.transport.udp.PeerState2: Dead: 11.111.11.11:22222 F~UzS1 IB2 recvAge: 5s sendAge: 5s sendAttemptAge: 5s sendACKAge: 0ms lifetime: 5s RTT: 50 RTTdev: 19 RTO: 1000 MTU: 1280 LMTU: 1500 cwin: 7315 acwin: 4535 SST: 524288 FRTX? false consecFail: 0 msgs rcvd: 1 msgs sent: 1 pkts rcvd OK/Dup: 2/0 pkts sent OK/Dup: 1/0 IBM: 0 OBQ: 0 OBL: 0\\n",
"level": "warning"
},
{
"line": "2023-10-25 03:33:42.121 ^^^ 2 similar messages omitted ^^^"
// when lines are repated, the replacmeent line does not have a log level
},
{
"line": "java.io.IOException: Peer is dead: F~UzS1mTN3XYlnOfidMBv5Z4lHI7dsCZ8N5mxpyc-OU=\\n"
// handle exception lines
},
{
"line": "\\u0009at net.i2p.router.transport.udp.PeerState2.getNextPacketNumber(PeerState2.java:326)\\n"
}
]
}
}
60 changes: 60 additions & 0 deletions src/formats/logcat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"logcat_log" : {
"title" : "logcat",
"description" : "The system logger format of the Android operating system.",
"url" : "https://developer.android.com/studio/command-line/logcat.html",
"regex" : {
"logcat_format_threadtime" : { // threadtime is a format accepted by the `logcat -v <format>` command
"pattern" : "^(?<timestamp>\\d{2}-\\d{2}\\s+\\d{2}:\\d{2}:\\d{2}.\\d{3})\\s+(?<log_pid>\\d+)\\s+(?<log_tid>\\d+)\\s+(?<level>\\w)\\s+(?:\\[@@\\s+\\]\\s)?(?<log_tag>.*)(?:\\s+)?:\\s+(?<body>.*)$"
}
},
"timestamp-format" : ["%m-%d %H:%M:%S.%L"],
"level-field" : "level",
"level" : {
"trace" : "^V",
"debug" : "^D",
"info": "^I",
"warning" : "^W",
"error" : "^E",
"fatal": "^F"
},
"opid-field" : "log_pid",
"value" : {
"log_pid" : {
"kind" : "string",
"identifier" : true
},
"log_tid" : {
"kind" : "string",
"identifier" : true
},
"log_tag" : {
"kind" : "string",
"identifier" : true
}
},
"sample" : [
{
"line": "01-01 02:50:25.351 1310 1502 V WindowManager: handleMessage: exit",
"level": "trace"
},
{
"line": "01-14 17:00:04.817 701 2042 I [email protected]: canChangeMode: 1 canChagedata: 1 canChangePower:1",
"level": "info"
},
{
"line": "01-14 17:00:03.978 24312 24778 D OffsetFinder: findOffsetCustom: found value 268959769 at 4 (with arg: 25)",
"level": "debug"
},
{
"line": "01-14 17:00:04.052 4453 4453 V com.jarsilio.android.waveup (ProximitySensorHandler): Proximity sensor changed: FAR (current sensor value: 5.0 - max. sensor value: 5.0)",
"level": "trace"
},
{
"line": "01-14 17:00:04.835 516 516 W Binder:516_1: type=1400 audit(0.0:1361): avc: denied { read } for name=\"wakeup8\" dev=\"sysfs\" ino=46048 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0",
"level": "warning"
}
]
}
}
32 changes: 32 additions & 0 deletions src/formats/syncthing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"syncthing_log" : {
"title" : "Syncthing",
"description" : "The Syncthing P2P file synchronization program's log format",
"url" : "https://syncthing.net/",
"regex" : {
"std" : {
"pattern" : "^\\[[A-Za-z0-9]{5}\\] (?<timestamp>\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}:\\d{2}(.\\d+)?) ?([a-zA-Z0-9.]+:\\d+:)? (?<level>\\w+): (?<body>.*)$"
}
},
"level-field" : "level",
"sample" : [
{
"line": "[AAAAA] 2024/07/04 13:11:39 INFO: Exiting",
"level": "info"
},
{
"line": "[start] 2024/07/04 13:10:53 INFO: syncthing v1.27.9",
"level": "info"
},
{
"line": "[AAAAA] 2024/07/02 13:37:27 WARNING: Automatically upgraded to version \"v1.27.9\". Restarting in 1 minute.",
"level": "warning"
},
{
"line": "[AAAAA] 2023/11/06 19:00:47.078070 local.go:203: DEBUG: discover: Received local announcement",
"level": "debug"
}
]
}
}