Server logs
List the log files of the MentDB server and read the end of one as dated entries, with the stack trace kept in its entry and a level guessed from the text, filtered by level, text or regular expression and time range, newest first, and group its stack traces by exception. Reserved to the users of the group sys. Typical uses: the log viewer of the MentDB editor, the last errors of the server sent by mail or chat.
log server_fileslog server_readlog server_readlog server_exceptionslog server_exceptions

log server_files


Description

    The log files of the server, the newest first: {dir, current (the file being written), max_size_mb, files: [{name, path, size, modified, current}]}

admin
log server_files
mentdb
{"dir": "logs", "current": "mentdb0.log", "max_size_mb": 30, "files": [{"name": "mentdb0.log", "path": "logs/mentdb0.log", "size": 505468, "modified": "2026-11-11 19:30:22", "current": true}]}

log server_read


Description

    The last entries of the current log file, newest first: {file, size, read_from (the byte where the reading started), whole_file, entries (in the part read), matched, returned, truncated, timed_out, skipped (entries where the regular expression was too deep for the Java engine), rows: [{line (in the part read), time, level, message, lines, detail}]}

admin
log server_read
mentdb
{"file": "mentdb0.log", "size": 337, "read_from": 0, "whole_file": true, "entries": 3, "matched": 3, "returned": 3, "truncated": false, "timed_out": false, "skipped": 0, "rows": [{"line": 4, "time": "2026-11-11 08:06:00.7+0400", "level": "warn", "message": "MentDB: Maximum number of sessions exceeded.", "lines": 1, "detail": ""}, {"line": 2, "time": "2026-11-11 08:05:10.5+0400", "level": "error", "message": "MQL SESSION ERROR (user 'bob', from 127.0.0.1, execution 3): java.lang.Exception: Sorry, the script x.exe does not exist.", "lines": 2, "detail": " at re.jpayet.mentdb.ext.script.ScriptManager.get(ScriptManager.java:720)"}, {"line": 1, "time": "2026-11-11 08:00:00.12+0400", "level": "info", "message": "[READY]", "lines": 1, "detail": ""}]}

log server_read <json_params>


Description

    Read a log file with parameters: file (the name of a file of log server_files, the current one by default), tail_bytes (1048576, 1024 to 52428800), level (all or info, warn, error: this level and above), text (searched in the message and the detail, case insensitive), regex (false: text is a plain text), case_sensitive (false), from and to (yyyy-MM-dd, yyyy-MM-dd HH:mm or yyyy-MM-dd HH:mm:ss, in the time of the server; to includes the whole minute or day given), limit (1000, 1 to 10000), order (desc: newest first, or asc), detail_max (20000 characters, 0 to 1000000), timeout_ms (10000, 100 to 60000)

Parameters

    json_params:   The parameters - String - required
admin
log server_read "{\"level\": \"error\", \"limit\": 1, \"detail_max\": 150}"
mentdb
{"file": "mentdb0.log", "size": 505468, "read_from": 0, "whole_file": true, "entries": 5195, "matched": 561, "returned": 1, "truncated": true, "timed_out": false, "skipped": 0, "rows": [{"line": 6576, "time": "2026-11-11 19:30:22.808+0400", "level": "error", "message": "MQL SESSION ERROR (user '', from 127.0.0.1, execution 1): java.net.SocketException: Connection reset", "lines": 7, "detail": " at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:318)\ at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)\ ..."}]}
Fixed result of a real run on 2026-11-11 (the log changes all the time): the starts of the server since 19:00
admin
log server_read "{\"text\": \"READY\", \"from\": \"2026-11-11 19:00\", \"limit\": 2}"
mentdb
{"file": "mentdb0.log", "size": 505468, "read_from": 0, "whole_file": true, "entries": 5195, "matched": 2, "returned": 2, "truncated": false, "timed_out": false, "skipped": 0, "rows": [{"line": 6575, "time": "2026-11-11 19:30:18.981+0400", "level": "info", "message": "[READY]", "lines": 1, "detail": ""}, {"line": 6544, "time": "2026-11-11 19:27:39.475+0400", "level": "info", "message": "[READY]", "lines": 1, "detail": ""}]}
Fixed result of a real run on 2026-11-11 (the log changes all the time): a regular expression, warnings and errors only
admin
log server_read "{\"level\": \"warn\", \"text\": \"sessions? exceeded\", \"regex\": true, \"limit\": 1}"
mentdb
{"file": "mentdb0.log", "size": 505468, "read_from": 0, "whole_file": true, "entries": 5195, "matched": 15, "returned": 1, "truncated": true, "timed_out": false, "skipped": 0, "rows": [{"line": 4338, "time": "2026-11-04 12:53:02.853+0400", "level": "warn", "message": "MentDB: Maximum number of sessions exceeded.", "lines": 1, "detail": ""}]}
Fixed result of a real run on 2026-11-11 (the log changes all the time): only the last 4 KB of the file, without the details
admin
log server_read "{\"level\": \"warn\", \"limit\": 3, \"detail_max\": 0, \"tail_bytes\": 4096}"
mentdb
{"file": "mentdb0.log", "size": 505468, "read_from": 501374, "whole_file": false, "entries": 37, "matched": 2, "returned": 2, "truncated": false, "timed_out": false, "skipped": 0, "rows": [{"line": 43, "time": "2026-11-11 19:30:22.808+0400", "level": "error", "message": "MQL SESSION ERROR (user '', from 127.0.0.1, execution 1): java.net.SocketException: Connection reset", "lines": 7, "detail": ""}, {"line": 12, "time": "2026-11-11 19:27:43.489+0400", "level": "error", "message": "MQL SESSION ERROR (user '', from 127.0.0.1, execution 1): java.net.SocketException: Connection reset", "lines": 7, "detail": ""}]}
A file outside the folder logs is refused
admin
log server_read "{\"file\": \"../conf/server.conf\"}"
mentdb
ERROR: Sorry, an error appears (the parameter 'file' must be the name of a .log file of the folder logs (as given by log server_files), without a path).

log server_exceptions


Description

    The stack traces of the current log file (its last 10 MB) grouped by exception, as log exceptions gives them: {file, size, read_from, whole_file, lines, exceptions, groups, not_grouped, truncated, rows: [{fingerprint, language, exception, message, message_template, count, first_seen, last_seen, first_line, distinct_messages, frames, causes, root_cause}]}. The server writes the exception at the end of its dated line (MQL SESSION ERROR (...): java.net.SocketException: ...): it is first put on a line of its own, so first_line counts these extra lines

admin
log server_exceptions
mentdb
{"file": "mentdb0.log", "size": 893, "read_from": 0, "whole_file": true, "lines": 14, "exceptions": 3, "groups": 2, "not_grouped": 0, "truncated": false, "rows": [{"fingerprint": "d87311e7ed948f04", "language": "java", "exception": "java.net.SocketException", "message": "Connection reset", "message_template": "Connection reset", "count": 2, "first_seen": "2026-11-11T08:07:00.3+04:00", "last_seen": "2026-11-11T08:09:00.9+04:00", "first_line": 7, "distinct_messages": 1, "frames": ["java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:318)"], "causes": [], "root_cause": "java.net.SocketException: Connection reset"}, {"fingerprint": "b7e26ff0a5bba15c", "language": "java", "exception": "java.lang.Exception", "message": "Sorry, the script x.exe does not exist.", "message_template": "Sorry, the script x.exe does not exist.", "count": 1, "first_seen": "2026-11-11T08:05:10.5+04:00", "last_seen": "2026-11-11T08:05:10.5+04:00", "first_line": 3, "distinct_messages": 1, "frames": ["re.jpayet.mentdb.ext.script.ScriptManager.get(ScriptManager.java:720)"], "causes": [], "root_cause": "java.lang.Exception: Sorry, the script x.exe does not exist."}]}

log server_exceptions <json_params>


Description

    Group the stack traces with parameters: file (the name of a file of log server_files, the current one by default), tail_bytes (10485760: the last 10 MB of the file, 1024 to 52428800), frames, fingerprint_frames, max_groups, with_message (as log exceptions), timeout_ms (60000)

Parameters

    json_params:   The parameters - String - required
admin
log server_exceptions "{\"file\": \"../../etc/hosts\"}"
mentdb
ERROR: Sorry, an error appears (the parameter 'file' must be the name of a .log file of the folder logs (as given by log server_files), without a path).
A parameter of log exceptions with a wrong type
admin
log server_exceptions "{\"frames\": \"many\"}"
mentdb
ERROR: Sorry, an error appears (the parameter 'frames' must be an integer from 0 to 100).