Searches and tails the current tenant's rolling server log files, backing the admin View Logs screen. Registered as the logsManager service so it can be reached from server-side JS. The searchLogs method greps the tenant's rolling log files for a set of search terms and streams the matching lines straight to an output stream. The startTail and getTailer methods support tailing newly written log lines into an in-memory per-tailer buffer that a caller polls and clears.
Group: Managers
Methods
newSearchRequest()
Returns: LogSearchRequest
Creates a new, empty search request. Configure it with search terms, an optional server name filter and whether to restrict the search to the current log file, then call search on it to run the search.
searchLogs(LogSearchRequest r, OutputStream out)
Returns: void
Runs a log search built from a LogSearchRequest: shells out to grep against the current tenant's rolling log files and writes each matching line, with a few lines of surrounding context, straight to the given output stream as they arrive. The search terms are validated against a restrictive safe-character pattern before use, since they are interpolated directly into a shell command.
| Parameter | Description |
|---|---|
r | the search request describing which log files to search and which terms to grep for |
out | the destination stream that matching lines are written to; not closed by this method |
startTail()
Returns: KademiTailer
Starts tailing the current tenant's active log files and caches the resulting tailer, keyed by its id, so it can be retrieved later with getTailer. Each call creates a new tailer with its own id and line buffer; the caller is responsible for polling it for new lines and it is stopped and evicted automatically once it has been idle for too long.
getTailer(String id)
Returns: KademiTailer
Looks up a previously started tailer by the id returned from startTail.
| Parameter | Description |
|---|---|
id | the tailer's id, as returned by startTail |