Add limit and order to query log request

Add optional limit to the number of log records to return in the
log query request to avoid having the web interface instance console
download the entire log for only to show a few hundred lines from it.

To make it possible to query the end of the log instead of just the
start add an order option as well.
This commit is contained in:
Hornwitser committed 2021-09-11 19:11:30 +02:00
1 parent 9aebeeac02
commit e3d8aa1a9b
5 files changed
+53 -2

No files matched your search

+4 -1
View File
@@ -456,12 +456,15 @@ class ControlConnection extends BaseConnection {
// - The log file is read starting from the beginning
let setDuration = lastQueryLogTime.startTimer();
let log = await query({
order: "asc",
order: message.data.order,
limit: Infinity,
from: new Date(0),
});
log = log.filter(this.constructor.logFilter(message.data));
if (message.data.limit) {
log = log.slice(0, message.data.limit);
}
setDuration();
return { log };
}