At one time, I had to work a lot with logs. They could be large and on different servers. It was required not to find something specific, but to understand why the system behaves not as it should. For some reason, there was no log aggregator.
I wanted to have a log viewer that allows, at any time, to open any file without downloading it to the local machine, like the less command in the linux console. But at the same time, there should be convenient text highlighting, as in IDE, and filtering records by various parameters. Filtering and searching should work by events in the log, and not by lines, like grep, this is important when there are multi-line entries, for example, errors with stack traces. It should also be possible to view records from several files at once on one page, freezing them according to the timestamp, even if the files are located on different nodes.
And I figured out how to make such a utility!
Log Viewer - web-, , , Web . , , , , . .
« ? c ». , , 1 3,5, . , , , , , . .
, ; severity , .
, , «+» «…» , , , . . . Java IDE.
: «~.SecurityManager». , «~».
, . , . , Ctrl+C, , .
, , , :
. , , . . , severity, UI :
Severity filter
. , « ». , . , .
« » « », . .
JavaScript. true false.
JavaScript
function isVisibleEvent(text, fields) {
var match = text.match(/Task completed, elapsed time: (\d+)ms$/)
if (!match)
return false // Don't show events not matched the pattern
var time = parseInt(match[1])
return time > 500 // Show only events where elapsed time is more than a threshold
}
, . , , . , , , .
URL, .
,
- — , , , , , , ..
, .
, . , . . , . . log4j, logback . , — issue GitHub, .
— . «.log» , . :
logs = [
{
path: "/opt/my-app/logs/*.log"
},
{
path: ${HOME}"/work/**"
}
]
.log /opt/my-app/logs ~/work .
, — , . , . , Log Viewer. web UI , , Log Viewer LogViewer . - .
. , , « N », N — . , N . , « N T», T — . . , . , / T, , . , . .
, UI , URL :
http://localhost:8111/log?path=/opt/my-app/logs/a.log@hostname1&path=/opt/my-app/logs/b.log@hostname1&path=/opt/my-app/logs/c.log@hostname2
"path" , "@" , . . "@" — . URL, , log-paths = { … }
.
Log Viewer Java Web , . . Maven/Gradle spring context. , log viewer . UI /logs, . Log4j Logback.
, — discussions GitHub.
, . , . , , .
UI. , JSON, , . severity , .
Sometimes there is no way to open a port on the server to view the logs, there is only SSH access. You can make support for work via SSH. The Web UI will rise on the local machine, connect via SSH to the server and launch a special agent there. The agent will accept commands through the input stream and return the required parts of the log through the output stream.
I'd love to hear your feedback.
Project on GitHub: https://github.com/sevdokimov/log-viewer