Solutions
...
Litmus Production Record Datab...
Interacting with Litmus Produc...

Reading out the Log Tables for Litmus Production Record Database

7min

Use Cases

To ensure the supportability and sustainability of Litmus Production Record Database reading out the log for the various subsystems to monitor for example for errors is one of the cornerstones of a support strategy.

User can do this either by using applications such as:

  • Microsoft SQL Server Management Studio
  • MSSQL CLI

This can also be used for building custom solutions based on applications which allow for an ODBC connection such as:

  • Excel
  • C#
  • .Net
  • Python

Litmus does provide a function for this which can be used in either a SELECT statement as well can be part of a custom stored procedure.

Method

Run SELECT query with Function PROREC_Misc_GetLogFileDataUTC as FROM clause.

Note

As the log tables for the various sub systems can store a lot of entries in the verbose mode, to not overwhelm the storage requirements for Litmus Production Record Database, the table holds by default only one day of records. This can be modified through the stored procedure introduced by the chapter Modify Application Configuration Items

Input Variables

Variable name

Datatype

Description

Example

@LogFile

VARCHAR (25)

This can be used to return entries of only one specific log table.

Available are:

  • Tag_Log: Log entries associated with the subsystem which stores handles storing of Tag Data
  • ProRec_Log: Log entries associated with the subsystem which handles storing of Production Record Events
  • Event_Log: Log entries associated with the subsystem which handles the monitoring of tag data for production events and then record these events
  • Misc_Log: Log entries for miscellaneous tasks like backup creation, factory reset or purging of tables
  • ERROR_Log: Log entries from the dedicated error log table

If no specific table is to be queried for, the value can be left as DEFAULT which will return data from all tables.

Tag_Log





































DEFAULT

@LogType

VARCHAR (25)

This can be used to only return entries for a specific log type such as INFO, WARNING, ERROR.

If no specific log type is to be queried for, the value can be left as DEFAULT which will return all log types.

INFO





DEFAULT

@LogProcedure

VARCHAR (50)

This can be used to only return entries created by a specific stored procedure which is part of a Litmus Production Record Database sub system

If no specific log type is to be queried for, the value can be left as DEFAULT which will return all log types.

PROREC_AT_Tag_ProcessTransactions







DEFAULT

@StartTime

DATETIME

The start of the time period for which to query data. If no specific start time is required, the value can also be DEFAULT which will assume the value null. This will trigger the function to calculate a start time of -1h from the current time stamp. This means the default time period for which data are returned is always the last hour.

2023-03-09T13:04:39.647



DEFAULT

@EndTime

DATETIME

The end of the time period for which to query data. If no specific end time is required, the value can also be DEFAULT which will assume the value null. This will trigger the function to use the current time stamp. This means the default time period for which data are returned is always the last hour.

2023-03-10T13:04:39.647



DEFAULT

How to use

To read out the log data, execute a SELECT statement from the function PROREC_Misc_GetLogFileDataUTC providing all the required inputs. Below is an example using T-SQL in SQL Server Management Studio:

SELECT * FROM [dbo].[PROREC_Misc_GetLogFileDataUTC] ( DEFAULT ,DEFAULT ,DEFAULT ,DEFAULT ,DEFAULT)

Result

The function returns a table as result.

Document image


Additional Options

It is possible to sort data based on users requirements returned by the SELECT statement. Below is an example using T-SQL in SQL Server Management Studio:

SELECT * FROM [dbo].[PROREC_Misc_GetLogFileDataUTC] ( DEFAULT ,DEFAULT ,DEFAULT ,DEFAULT ,DEFAULT) ORDER BY LogTime desc

The result will be a table, where all rows are sorted by their LogTime in descending order.

Document image