Pages

Monday 7 January 2013

Deleting Log records from Log Database


As we all know, Genesys applications can be configured to store log records in database. Unfortunately, there is no automatic maintenance option and have to purge data either manually or schedule script for this.

Manual Process

You can use ‘Log Database Maintenance Wizard’ from SCI to maintain database. If there are large number of records in database, GUI get stuck and many times, have to kill it. And you don't want to do this everyday, don't you.

Schedule it

You can use steps below to automate the process. But, this is manual process and was looking to automate it. Fortunately, we don’t have to dig deep for this as SQL scripts are available from the wizard itself. You can easily find that log records are stored in two tables as below
  • G_LOG_MESSAGES
  • G_LOG_ATTRS
and to delete logs which are older than 15 days, use script below

   1: delete from G_LOG_ATTRS where LRID not in (select G_LOG_MESSAGES.ID from G_LOG_MESSAGES)

   2:  

   3: delete from G_LOG_ATTRS where LRID in (select G_LOG_MESSAGES.ID from G_LOG_MESSAGES where TIMEGENERATED < DATEADD(DAY, -15, GETDATE()))

   4:  

   5: delete from G_LOG_MESSAGES where TIMEGENERATED < DATEADD(DAY, -15, GETDATE())


You need to run this in the same order as above and recommend to schedule to run every 24 hours. You can configure this as SQL Server Agent job or run this sql as scheduled task from windows.

No comments:

Post a Comment