skipcheck

TM1 client · Docs · The server

LogService

import { LogService } from "@skipcheck/tm1-client";

Used in the walkthrough Run a process and read its result.

The server's logs: the message log, the transaction log (cell changes), the audit log (changes to objects and security), and the error logs processes write.

What TM1 (11.8) does here that you might not expect:

  • An entry's ID numbers it within the response, not in the log: the same entry gets another ID in the next request, and TM1 refuses to fetch an entry by its ID (501, "Indexing of message log entries is not supported"). So there's no get by ID here.
  • A message log entry without a time, such as the log's first line, has the TimeStamp 0000-00-00T00:00Z; it's read as null.
  • The transaction and audit logs only fill when they're switched on (a cube's logging, and AuditLog in the configuration).

Read the newest message log entries:

// The 50 newest entries, newest first
return tm1.logs.messageLog(true, ODataQuery.none().top(50));

Follow the message log for errors:

// Errors as they're written, polled every 5 s, until the signal is aborted
for await (const entry of tm1.logs.tailMessageLog(5000, { signal })) {
  if (entry.Level === LogLevel.Error) console.error(`${entry.Logger}: ${entry.Message}`);
}

Read a process's error logs:

// What each error log of one process says
const contents: string[] = [];
for await (const file of tm1.logs.errorLogFiles()) {
  if (file.Filename?.endsWith("_Load Sales.log")) contents.push(await tm1.logs.errorLogContent(file.Filename));
}
return contents;

Count the cell changes in the transaction log:

// How many cell changes the transaction log holds, leaving out its status lines
let count = 0;
for await (const _ of tm1.logs.transactionLog(false, true)) count++;
return count;

Members

messageLogEntriesGET MessageLogEntries, streamed, oldest first unless ordered otherwise; filter on Level or TimeStamp, and say how many, with query.
messageLogThe message log, streamed, newest first if reverse.
transactionLogEntriesGET TransactionLogEntries, streamed.
transactionLogThe transaction log, streamed, newest first if reverse, and without status lines, keeping cell changes, if ignoreStatusMessages.
auditLogEntriesGET AuditLogEntries, streamed; empty unless the audit log is on.
tailMessageLogFollows the message log.
tailTransactionLogFollows the transaction log, as tailMessageLog does the message log.
tailAuditLogFollows the audit log, as tailMessageLog does the message log.
errorLogFilesGET ErrorLogFiles, streamed.
errorLogFileThe file, or a Tm1NotFoundException if there's none.
errorLogContentWhat the file says, as text, read whole.

messageLogEntries

messageLogEntries(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<MessageLogEntry>

GET MessageLogEntries, streamed, oldest first unless ordered otherwise; filter on Level or TimeStamp, and say how many, with query.

TM1 REST EntitySet MessageLogEntries

messageLog

messageLog(reverse: boolean, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<MessageLogEntry>

MessageLog(Reverse=…): the message log, streamed, newest first if reverse.

TM1 REST FunctionImport MessageLog

transactionLogEntries

transactionLogEntries(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<TransactionLogEntry>

GET TransactionLogEntries, streamed. Besides cell changes, the log holds status lines (such as CubeSerialized: …) with only StatusMessage set.

TM1 REST EntitySet TransactionLogEntries

transactionLog

transactionLog(reverse: boolean, ignoreStatusMessages: boolean, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<TransactionLogEntry>

TransactionLog(Reverse=…,IgnoreStatusMessages=…): the transaction log, streamed, newest first if reverse, and without status lines, keeping cell changes, if ignoreStatusMessages.

TM1 REST FunctionImport TransactionLog

auditLogEntries

auditLogEntries(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<AuditLogEntry>

GET AuditLogEntries, streamed; empty unless the audit log is on. query can expand AuditDetails, the entry's details.

TM1 REST EntitySet AuditLogEntries Navigation AuditLogEntry/AuditDetails

tailMessageLog

tailMessageLog(every: number, options?: Tm1CallOptions): Tm1Stream<MessageLogEntry>

Follows the message log: the entries written from the moment it's iterated, polling every every milliseconds until the iteration stops or options.signal aborts (which ends it with the signal's reason). Built on TailMessageLog() (schema 11.3.0).

TailMessageLog() returns a delta link, but TM1 (11.8) answers it with every entry since the link was made, each time, and with no next link. So this keeps the one link and skips the entries it has already yielded, and each poll fetches more the longer it runs. For a long watch, start afresh now and then.

TM1 REST FunctionImport TailMessageLog

tailTransactionLog

tailTransactionLog(every: number, options?: Tm1CallOptions): Tm1Stream<TransactionLogEntry>

Follows the transaction log, as tailMessageLog does the message log. Built on TailTransactionLog() (schema 11.3.0).

TM1 REST FunctionImport TailTransactionLog

tailAuditLog

tailAuditLog(every: number, options?: Tm1CallOptions): Tm1Stream<AuditLogEntry>

Follows the audit log, as tailMessageLog does the message log. Built on TailAuditLog() (schema 11.6.0).

TM1 REST FunctionImport TailAuditLog

errorLogFiles

errorLogFiles(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ErrorLogFile>

GET ErrorLogFiles, streamed: the error logs processes have written, such as tm1processerror_<time>_<process>.log.

TM1 REST EntitySet ErrorLogFiles

errorLogFile

errorLogFile(filename: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ErrorLogFile>

GET ErrorLogFiles('name'): the file, or a Tm1NotFoundException if there's none.

TM1 REST EntitySet ErrorLogFiles

errorLogContent

errorLogContent(filename: string, options?: Tm1CallOptions): Promise<string>

GET ErrorLogFiles('name')/Content: what the file says, as text, read whole. TM1 (11.8) starts it with a byte order mark, which is dropped.

TM1 REST EntitySet ErrorLogFiles