Writing Process Statistic Data to an External Database

A customized database appender can also be used to collect statistics. Once statistics are in a database, reporting tools like TIBCO Jaspersoft or TIBCO Spotfire can be used to create graphs or reports. Add the following appenders to APPENDER: File Appender section of the logback.xml file to log data to an external database.

You can log process statistics data from applications running on existing or new AppNodes:
Note: The supported databases are Oracle Database 12c, MySQL 5.7.x, Microsoft SQL Server 2012, 2014, PostgreSQL 9.2.x.
  • To log process statistic data from applications running on existing AppNodes, edit the logback.xml file located at BW_HOME/domains/<domain_name>/appnodes/<appspace_name>/<appnode_name>. Restart the AppNode after you have finished editing the file.
  • To log process statistic data from applications that will run on new AppNodes, edit the logback.xml file at <BW_HOME>/config/ before you create the new AppNodes.

Procedure

  1. Update the property, bw.agent.technology.logbackappender=true in the bwagent.ini file.
  2. Complete the following sub-steps to configure the external database properties in your bwagent configuration file, located at <BW_HOME>/config/. For example, follow these steps to edit these database settings in the bwagent_db.json file.
    statsprovider: false, 
    providertechnology: "db",
    dbprovidertype: postgresql,
    dbproviderdriver: "org.postgresql.Driver",
    dbproviderconnectionurl: "jdbc:postgresql://localhost:5432/bwadmindb",
    dbprovideruser: bwuser,
    dbproviderpassword: bwuser,
    
    1. Set statsprovider to true.
    2. Do not change the value for the providertechnology property.
    3. Use the same database details specified in the bwagent.ini file to set the dbprovidertype, dbproviderdriver, dbproviderconnectionurl , dbprovideruser, and dbproviderpassword properties.
    4. Run the bwadmin config command with the -cf option to push the changes from the JSON file to the bwagent.ini file.
      BW_HOME\bin>bwadmin config -cf ../config/bwagent_db.json agent
  3. Edit the logback.xml file, located at BW_HOME/domains/<domain_name>/appnodes/<appspace_name>/<appnode_name>, and add the following appender:
    <appender name="activityStatsDBAppender" class="com.tibco.bw.thor.management.stats.logback.db.BWActivityStatsDBAppender">
            <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
                 <driverClass>org.postgresql.Driver</driverClass>
                 <url>jdbc:postgresql://localhost:5432/bwadmindb</url>
                 <user>bwuser</user>
                 <password>bwuser</password>
        </connectionSource>
     </appender>
    
     <appender name="processInstanceStatsDBAppender" class="com.tibco.bw.thor.management.stats.logback.db.BWProcessInstanceStatsDBAppender">   
        <connectionSource  class="ch.qos.logback.core.db.DriverManagerConnectionSource"> 
                  <driverClass>org.postgresql.Driver</driverClass> 
                  <url>jdbc:postgresql://localhost:5432/bwadmindb</url> 
                  <user>bwuser</user> 
                  <password>bwuser</password> 
        </connectionSource> 
     </appender> 
    Note: Ensure the values you set for the driverClass, url, user, and password properties match the values set in the bwagent.ini file.
  4. Locate the "LOGGER: BusinessWorks statistics collection loggers" section in the logback.xml file, and add the following appender to the appender-ref for activity logger and processinstance logger.
     <logger name="com.tibco.bw.statistics.activity" additivity="false">
        <level value="INFO"/>
        <appender-ref ref="activityStatsDBAppender"/>
      </logger>
     
     <logger name="com.tibco.bw.statistics.processinstance" additivity="false">
        <level value="INFO"/>
        <appender-ref ref="processInstanceStatsDBAppender"/>
      </logger>
  5. Enable process statistics collection. For more information about enabling statistics collection from the command line or the Admin, see Enabling and Disabling Process Statistics.