-
Hi everyone, I've started using lnav recently and like it a lot despite the initial learning curve. I work with python and only need my logs to have the time of the log line for my purposes. From python I log the time of execution, but not the date. I wrote a custom format for myself, and lnav correctly identifies the timestamp of each log line in my sample and in my logs. However, lnav then adds the date to the log line when I'm viewing it. Is there a way to disable this feature? Thanks for reading. I'm going to attach an example of lnav adding the date and my custom format json. {
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"pythonlogger": {
"title": "Python logger format",
"description": "Log format used by python logger class",
"url": "",
"regex": {
"main": {
"pattern": "^\\[(?<timestamp>\\d{2}:\\d{2}:\\d{2},(\\d{3})?)\\] (?<level>[^ ]*) (?<module>[^ ]*) (?<message>.*)$"
}
},
"timestamp-format": [ "%H:%M:%S,%L" ],
"level-field": "level",
"level": {
"critical": "CRITICAL",
"error": "ERROR",
"warning": "WARNING",
"info": "INFO",
"debug": "DEBUG",
"notset": "(--)"
},
"value": {
"timestamp": { "kind": "string", "hidden": true },
"level": { "kind": "string", "identifier": true },
"module": { "kind": "string", "identifier": true, "hidden": true },
"message": { "kind": "string" }
},
"sample": [
{
"line": "[22:15:50,323] DEBUG Log file intialized at log.txt"
}
]
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, in logs with partial or machine-friendly timestamps, the timestamp will be replaced with a human-friendly timestamp.
Not at the moment, no. |
Beta Was this translation helpful? Give feedback.
Yes, in logs with partial or machine-friendly timestamps, the timestamp will be replaced with a human-friendly timestamp.
Not at the moment, no.