COSMOS CBE RDB

From Eclipsepedia

Jump to: navigation, search

Cbe2rdb.jpg

Problems encountered

  1. database mapping:
    • There are fields in the TPTP database model that not part of the CBE spec, but required for the TPTP log analyzer to work. If we ignore these fields, the DB populated by this usecase can't be used by TPTP.
    • Timestamp is String in data object but is double in database
    • ID generation: TPTP DB schema does not use auto ID generation function of derby. The ID field is not part of the data model. iBatis requires a one-to-one mapping between object member variable with database column. I have now changed the TPTP schema to use auto key generation function. Another solution is to wrap the objects with a subclasses that contains the id field, but it's a more heavy weight solution.


Ideally, we want:

  • The datasource to be able to monitor live data and reading in static log files.
  • The data collected using the COSMOS datacollection to be able to be used by COSMOS web front end via the query interface and by TPTP workbench.

Running the CBE data collection and query sample

<pu:Property propertyName="directory" propertyValue="C:\demo\cosmos\logs"/>
<pu:Property propertyName="fileName" propertyValue="net_access_log.log"/>
    • Windows Application Log: In WindowsAppLog.xml, update the Sensor section. Change the values of directory and converter to point to the EventLogReader.exe program, which is packaged in the org.eclipse.cosmos.tptp.dependencies module. Replace <path> with the path to the org.eclipse.cosmos.tptp.dependencies module.
<cc:Sensor ...>
  <pu:Property propertyName="directory" propertyValue="<path>\org.eclipse.cosmos.tptp.dependencies"/>
  <pu:Property propertyName="fileName" propertyValue="error.log"/>
  <pu:Property propertyName="converter" propertyValue=""<path>\org.eclipse.cosmos.tptp.dependencies\EventLogReader.exe" application <path>\org.eclipse.cosmos.tptp.dependencies\error.log"/>
</cc:Sensor>
  • At osgi prompt, load CBE assembly and query configurations:
dc load CBEPersistor.xml
dc load WindowsAppLog.xml
dc load CBEQuery.xml
dc load CBECount.xml
  • Activate data collection for Apache/Tomcat access log.
dc activate CBEPersistor
  • Activate data collection for Windows Application Log.
dc activate WindowsAppLog
  • Query for all datasets in the database:
dc list datasets
  • List all CBE in database. Replace <dataset> with a dataset ID.
spec query cbe <dataset>
  • List CBE count by severity, grouped by component. Replace <dataset> with a dataset ID.
spec query cbeCount <dataset>

Enabling access log in Tomcat

By default, access log is disabled in Tomcat. To generate access logs, edit server.xml in the conf directory of the Tomcat server, and uncomment the following section.

        <!--
        <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
                 directory="logs"  prefix="localhost_access_log." suffix=".txt"
                 pattern="common" resolveHosts="false"/>
        -->