Genesys - 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.

Delete logs manually


You can use ‘Log Database Maintenance Wizard’ from Genesys SCI to maintain database. If there are large number of records in database, SCI application will become unresponsive and we have to kill it forcefully.

Delete logs – Schedule it


You can use steps below to automate the process. 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

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

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

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.