Are there any guides anywhere for how to go about creating a new format?
I'm trying to add a format for the macOS .logarchive file. I can convert it to plain text with "log show --style compact" and get logs that look like this:
2019-06-10 16:42:12.571 Df wcd[60:451] [com.apple.wcd:WC] Starting up │
I have my JSON file created and it no longer has parse errors, but it isn't used either. When I point Lnav at my log file it still parses as generic_log, not my custom "example_log" format.
This is my JSON:
{
"example_log" : {
"title" : "Example Log Format",
"description" : "Log format used in the documentation example.",
"regex" : {
// "header": {
// "pattern" : "^Timestamp[^\\0] Ty Process\\[PID:TID]$"
// },
"basic" : {
"pattern" : "^(?<timestamp>\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3}) (?<level>\\w+) (?<process>[^[]+)\\[(?<pid>\\d+):(?<tid>\\d+)\\] \\[(?<subsystem>[^:]+):(?<category>[^\\]]+)\\] (?<body>[^\\0]*)$"
}
},
"level-field" : "level",
"level" : {
"error" : "E",
"warning" : "W"
},
"value" : {
"component" : {
"kind" : "string",
"identifier" : true
}
},
"sample" : [
{
"line" : "2019-06-10 16:42:12.271 Df mobiletimerd[51:42d] [com.apple.mobiletimer.logging:Agent] mobiletimerd starting...",
"line" : "2019-06-10 16:42:12.274 Df mobiletimerd[51:477] [com.apple.mobiletimer.logging:Agent] <MTAgent: 0x155000f00> has launched",
"line" : "2019-06-10 16:42:12.275 Df mobiletimerd[51:477] [com.apple.mobiletimer.logging:Alarms] Initializing <MTUserNotificationCenter: 0x153e15180>..."
}
]
}
}