26.14. LinkDB changes are logged

Problem:

Up to V10 it was not possible to check who changed or created an ERP dataset. This is possibly causing a lot of confusion.[128]

Solution:

An extra table named LOGTABLE has been added.

So now INSERTS, DELETES and manual UPDATES (by PARTlinkManager or PARTdataManager) are automatically logged here.

Furthermore the log information is used to update the ERP search index. See below.

Structure of LOGTABLE

LOGID VARCHAR(40) NOT NULL,
TABNAME VARCHAR(15) NOT NULL,
KEYFLD VARCHAR(15) NOT NULL,
LOGKEY VARCHAR(500) NOT NULL,
LOGEXT VARCHAR(64),
LOGTIME VARCHAR(20) NOT NULL,
USERNAME NVARCHAR(20),
HOSTNAME NVARCHAR(20),
PROGNAME VARCHAR(15),
MODTYPE SMALLINT DEFAULT 0 NOT NULL,
UPDSEARCH SMALLINT DEFAULT 0 NOT NULL,

You can view this table via PARTlinkManager -> Extras menu -> Database -> Edit additional tables.

If in plinkcommon.cfg under ADDITIONALTABLES the entry LOGTABLE has been set it is displayed here.

If in plinkcommon.cfg under ADDITIONALTABLES the entry LOGTABLE has been set it is displayed here.

Meaning of single LOGTABLE columns

  • LOGID: LOGID is an unique number (GUID)

  • TABNAME: Table, where changes are stored, meaning ERPTABLE or LINKTABLE.

  • KEYFLD:

    • For ERPTABLE this is always ERP_PDM_NUMMER and LOGKEY contains the ERP number

    • For LINKTABLE this is always PRJ_PATH and LOGKEY contains the path

  • LOGEXT: Additional information. At LinkDB changes this is version and line ID.

  • LOGTIME: Time of change (in UTC)

  • USERNAME: Login name of user, which performed the change

  • HOSTNAME: Computer name of client

  • PROGNAME: Program, where changes have been performed

  • MODTYPE: Modification type

    Value range:

    • 1: Insert (dataset has been added)

    • 2: Update (dataset has been changed)

    • 3: Delete (dataset has been deleted)

    • 4: Installation (updates during cip installation)

  • UPDSEARCH: If UPDSEARCH is 1 then the ERP search index should be updated. Will be turned back to 0 by the AppServer after finished update

Configuration in pappserver.cfg

In the configuration file pappserver.cfg, tasks can be defined. Currently these are:

  • Task for checking whether there are new entries in the LOGTABLE. If yes, the ERP search index is updated.

  • Task for clearing the LOGTABLE.

Example:

[TaskManagerModule]
TimerInterval=60 
tasks=loadAll 
DBSearchIndexTask=1h
DBClearLogTask=24h

[DBClearLogTask] 
DaysToKeep=365

Explanations on the single setting options

  • TimerInterval: Specification in which interval (seconds) it shall be checked whether a new task is pending. Normally this does not have to be adjusted.

  • tasks:

    Value range:

    • loadAll: All Task Modules shall be loaded when launching the AppServer. Currently there are only two:: DBSearchIndexTask and DBClearLogTask

  • DBSearchIndexTask: Task interval for updating the ERP search index. The task checks the LOGTABLE whether there are new entries available. If yes, the ERP search index is updated.

  • DBClearLogTask: Task interval for clearing the LOGTABLE. This task deletes all entries from LOGTABLE.

    Possible formats for date:

    1mTask is executed every minute
    1hTask is executed every hour
    13:21zTask is executed every day at 13:21 GMT
    mon 14:30Task is executed every Monday at 14:30 (locale time)

  • DaysToKeep: Number of days to store the entries in the LOGTABLE.




[128] #55241, #20318, #52425