The Runtime writes session information to the "log database". This article shows how to purge sessions from this database.
The purge described in this article will delete rows from the Runtime's session tables. Please note that some RDBMS systems need DBA operations in order to free the physical storage of tables and indexes (defragmentation, move, shrink, rebuild...).
General advice - Best practice
- Adjust your purge settings to what you need, feel free to combine parameters (see examples below)
- When running a purge for the first time in a big log database (never purged ?), DO NOT run the purge with your every day settings. It will last forever and may overload your Runtime.
- Example : launch purges manually with "keep 180 day", then "keep 150 day", then "keep 120 day" etc..., until you reach the desired setting
- See below (Purge log file) to know how to check when the purge has ended => wait for the end of a purge before launching a new one
- Schedule the purge at a time where there is no job running, or at least no big jobs
- Watch your log database : just like any other database, watch the disk space, cpu usage and ram usage
- See also the "logLevel" configuration which can prevent the log database from growing too fast
Using the "purge" command
This can be done from the Command tab in the Runtime editor (available in Analytics and in the Designer) :
A few examples for this command :
- purge keep 100 session: deletes all sessions except the last 100 sessions
- purge keep 50 session status killed: deletes all sessions with status "killed" except the last 50 killed sessions. The sessions with other status are left.
- purge keep 10 day: deletes all sessions older than 10 days.
- purge keep 3 session sessionname MONTHLY%: deletes all sessions whose name starts with "MONTHLY" except the 3 latest sessions.
You can also execute this command from your OS command line, using the startcommand utility :
> startcommand.bat "connect to localhost port 42000;purge keep 5 day"
Please note that when you execute a purge command on a runtime that uses a log database that is shared with other runtimes, it will affect all the sessions that are stored in the database (not only those that were written by the runtime that is executing the purge command).
Scheduling a purge in the Runtime Scheduler
The scheduler can purge the session logs automatically. To do this, select the "Purge" tab in the Runtime editor (available in Analytics and in the Designer) :
For more information on the sheduler and Cron examples, please read the Stambia Designer help.
Consulting purge log file
The log file "com.indy.engine.42000.rdbmsLog.log" contains information related to the log database.
When the purge is executed, you can consult this file to find out how many sessions were purged. Here is an example:
15/02/2019 14:35:25,229 INFO - Purging log database sessions...
15/02/2019 14:35:25,229 INFO - Delete until 2019/02/14 14:35:25.229: start
15/02/2019 14:35:25,251 INFO - Delete until 2019/02/14 14:35:25.229: Deleted 121 sessions
15/02/2019 14:35:25,251 INFO - Delete until 2019/02/14 14:35:25.229: Total of deleted sessions: 121
15/02/2019 14:35:25,251 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Action
15/02/2019 14:35:25,467 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist ChildSession
15/02/2019 14:35:25,467 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Delivery
15/02/2019 14:35:25,652 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist UAL
15/02/2019 14:35:25,652 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Action Static
15/02/2019 14:35:25,746 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Property Static
15/02/2019 14:35:26,069 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Action Statistic
15/02/2019 14:35:26,100 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Process Statistic
15/02/2019 14:35:26,115 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Session Statistic
15/02/2019 14:35:26,131 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist AltId
15/02/2019 14:35:26,184 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Link
15/02/2019 14:35:26,285 INFO - Delete until 2019/02/14 14:35:25.229: Delete Unexist Property
15/02/2019 14:35:26,532 INFO - Delete until 2019/02/14 14:35:25.229: End