Stambia DI Runtimes stores its executed sessions logs into a Log Database, which can be configured to use your own custom database.
This article explains how to set up the Runtime to write Session logs into a chosen RDBMS database, different than the default H2 database.
Runtime Configuration
Definition of the log database
The main entry point to configure the various parameters of the Runtime is Runtime's Configuration file.
This is where you will configure the Runtime Log Database.
This file is located, on a default installation, at the following location:
<Stambia Runtime Installation Folder>/properties/engineParameters.xml
You can find the configuration of the log database and documentation information directly inside this file.
The Log Database part is at the bottom of the file.
Examples with various databases are present and commented to give you starting points to define your database.
Those samples can also be found in dedicated files in the following directory:
<Stambia Runtime Installation Folder>/properties/samples/logs
Define the log database node corresponding to your requirements.
For instance, here is an example for defining the Log Database inside a MySQL database.
<!--
==============================
MySQL Log Database
==============================
-->
<logs>
<log userLogName="logDatabase" autoUpdate="true" userLogClass="com.indy.engine.userLog.RdbmsUserLog">
<parameter name="userLogRdbmsDriver" value="com.mysql.jdbc.Driver"/>
<parameter name="userLogRdbmsUrl" value="jdbc:mysql://mysqlhostname:3306"/>
<parameter name="userLogRdbmsUser" value="root"/>
<parameter name="userLogRdbmsPassword" value="password"/>
<parameter name="userLogRdbmsModule" value="default"/>
<parameter name="userLogRdbmsVarcharType" value="varchar"/>
<parameter name="userLogRdbmsVarcharMaxSize" value="1000"/>
<parameter name="userLogRdbmsNumericType" value="numeric"/>
<parameter name="userLogRdbmsClobType" value="longtext"/>
<parameter name="userLogRdbmsBlobType" value="longblob"/>
<parameter name="userLogRdbmsSchemaName" value="log database schema"/>
<parameter name="userLogRdbmsDeleteSyntaxe" value="Delete from"/>
<parameter name="userLogRdbmsUseSchemaNameForIndexCreation" value="false"/>
<parameter name="userLogRdbmsCompressedLevel" value="bestCompression"/>
<parameter name="userLogRdbmsDeliveryFormat" value="compressed"/>
<parameter name="userLogRdbmsPropertyMaxVarcharSize" value="1000"/>
<parameter name="userLogRdbmsPropertyMaxClobSize" value="10000"/>
<parameter name="userLogRdbmsPropertyBinaryFormat" value="compressed"/>
<parameter name="userLogRdbmsConnectionRetryNumber" value="20"/>
<parameter name="userLogRdbmsConnectionRetryDelay" value="1000"/>
<parameter name="userLogRdbmsConnectionEnableRetry" value="true"/>
</log>
</logs>
Notes
- The most common parameters to change are surrounded here, but you can too modify the others to your needs.
- If you are using a database which is not in the samples, you can take example on one of them and adapt it to your database. In this case, feel free to send your modified file to the Support, they will check it and may add it to the samples in the next Runtime release.
- You can set the clear password in the userLogRdbmsPassword parameter, or set the encrypted password in the userLogRdbmsEncryptedPassword parameter (just add this Xml element to the file if it is missing)
- The userLogName defined must match the userLogDefaultName will be used in the next paragraph.
Finally, make sure the the Runtime is properly using the defined database by making sure the userLogDefaultName parameter value matches the Log Database userLogName parameter value.
<parameters>
<engineParameters>
<...>
<parameter name="userLogDefaultName" value="logDatabase"/>
<...>
</engineParameters>
<...>
<logs>
<log userLogName="logDatabase" autoUpdate="true" userLogClass="com.indy.engine.userLog.RdbmsUserLog">
<parameter name="userLogRdbmsDriver" value="com.mysql.jdbc.Driver"/>
<parameter name="userLogRdbmsUrl" value="jdbc:mysql://mysqlhostname:3306"/>
<parameter name="userLogRdbmsUser" value="root"/>
<parameter name="userLogRdbmsPassword" value="password"/>
<parameter name="userLogRdbmsModule" value="default"/>
<parameter name="userLogRdbmsVarcharType" value="varchar"/>
<parameter name="userLogRdbmsVarcharMaxSize" value="1000"/>
<parameter name="userLogRdbmsNumericType" value="numeric"/>
<parameter name="userLogRdbmsClobType" value="longtext"/>
<parameter name="userLogRdbmsBlobType" value="longblob"/>
<parameter name="userLogRdbmsSchemaName" value="log database schema"/>
<parameter name="userLogRdbmsDeleteSyntaxe" value="Delete from"/>
<parameter name="userLogRdbmsUseSchemaNameForIndexCreation" value="false"/>
<parameter name="userLogRdbmsCompressedLevel" value="bestCompression"/>
<parameter name="userLogRdbmsDeliveryFormat" value="compressed"/>
<parameter name="userLogRdbmsPropertyMaxVarcharSize" value="1000"/>
<parameter name="userLogRdbmsPropertyMaxClobSize" value="10000"/>
<parameter name="userLogRdbmsPropertyBinaryFormat" value="compressed"/>
<parameter name="userLogRdbmsPropertyMaxVarcharSize" value="1000"/>
<parameter name="userLogRdbmsPropertyMaxClobSize" value="10000"/>
<parameter name="userLogRdbmsPropertyBinaryFormat" value="compressed"/>
<parameter name="userLogRdbmsConnectionRetryNumber" value="20"/>
<parameter name="userLogRdbmsConnectionRetryDelay" value="1000"/>
<parameter name="userLogRdbmsConnectionEnableRetry" value="true"/>
</log>
</logs>
</parameters>
Installation of JDBC Libraries
To be able to communicate with the configured database, the Runtime will need the corresponding JDBC Driver to be installed.
For instance, in the example of this article we are configuring a MySQL log database, so we need to install MySQL JDBC Driver.
Stambia DI 2020 (S20.x.x) and higher
Copy the JDBC driver of the database in the "default" Module of the Runtime.
On a default installation it is located under stambiaRuntime/modules/default
Stambia DI S17, S18, S19
Copy the jdbc libs corresponding to your database in <runtimeDirectory>/lib/jdbc
We used the mysql-connector-java-5.1.33-bin.jar for our example.
If you use Analytics to consult the runtime log database, you need to copy the jdbc libs in the Analytics corresponding directory. All is detailed in Analytics Installation and Configuration Guide here.
Starting the Runtime
When everything is configured and installed, you start your Runtime, or restart it if it was already running.
The first time the Runtime starts on a new configured database, it may take a little longer to start, because it will create all the tables needed for the logs in the database schema that you specified.
You should now have log tables in your schema:
Note about multiple Runtime on the same database
You can have multiple Runtimes using the same database schema to store logs. If it is the case, all will have the same logs which will be centralized at the same place.
We advise to use the same Runtime version for all the Runtimes when you do that, to avoid problems of different behavior between Runtime versions (older versions have less tables and columns for examples).