---
schema_version: "1"
id: eca1bacac67f5d06de5fc06dd44e385b9753fe1c9efde198db86a386ef686740
title: Send Event Data from Runtime Manager to an External Database
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/runtime-manager/sending-event-data-from-arm-to-db.md
canonical_url: https://docs.mulesoft.com/runtime-manager/sending-event-data-from-arm-to-db
source_site: docs.mulesoft.com
content_type: documentation
content_hash: e1e8b5cade5ca12f8e57d29c977dab685b578544f7bc1a64a8dc0c0991cebd9c
description: MuleSoft Documentation Site
latest: true
---
---
product: Runtime Manager
keywords: analytics, monitoring, logs, mule events, logging, apy analytics, metrics, traceability, arm, anypoint runtime manager, db, sql, mysql, oracle, jdbc
---

# Send Event Data from Runtime Manager to an External Database

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

[![logo hybrid active](/mulesoft/current/en-us/_/img/icons/hybrid-cloud.svg "Hybrid")Hybrid](deployment-strategies#hybrid-deployments)[ ![logo server active](/mulesoft/current/en-us/_/img/icons/server-cloud.svg "Anypoint Platform PCE")Private Cloud Edition](deployment-strategies#anypoint-platform-private-cloud-edition)

You can configure the Runtime Manager agent to store the event notifications from Mule apps in a
database.

Sending data to third-party software is available only for applications deployed to local servers.
It is not supported for applications deployed to CloudHub.

## Prerequisites

Ensure that the following software is installed:

- API gateway standalone version 2.1.0 or later

- Runtime Manager agent version 1.3.0 or later

  For information about updating the agent, see
  [Install or Update the Runtime Manager Agent](https://docs.mulesoft.com/runtime-manager/installing-and-configuring-runtime-manager-agent).

## Install Event-Tracking Database Internal Handlers

Depending on your version of the Runtime Manager agent, you might need to install the Event-Tracking
Database Internal Handlers ZIP file.

For the following agent versions, you don’t need to install the ZIP file because the required JAR
files are included in the agent plugin:

- 1.14.3 and later

- 2.4.5 and later

For the following agent versions, you must download and install the ZIP file manually:

- 1.14.2 and earlier

- 2.4.4 and earlier

To install the ZIP file:

1.  Request the Event-Tracking Database Internal Handlers ZIP file
    (`mule-agent-internal-handlers-db-1.5.1.zip`) from Support.

2.  Extract the ZIP file to the `{MULE_HOME}/plugins/mule-agent-plugin/lib/modules` folder.

## Agent Configurable Fields

After you have the latest Runtime Manager agent and the event-tracking database internal handlers
installed on your API gateway, enable the internal handler by modifying your
`{MULE_HOME}/conf/mule-agent.yml` configuration file.

In the following example configurations for MySQL Server, Oracle, and Microsoft SQL Server, the
required fields are `driver`, `jdbcUrl`, `user`, and `pass`. You can also configure the
`eventsTable`, `annotationsTable`, and `businessTable` fields to specify where the event data is
stored.

<table><colgroup><col> <col> <col> <col> <col></colgroup><thead><tr><th>Field</th><th>Data Type</th><th>Description</th><th>Type</th><th>Default Value</th></tr></thead><tbody><tr><td><p><code>driver</code></p></td><td><p>String</p></td><td><p>The JDBC driver to use to communicate with the database server</p></td><td><p>Required</p></td><td></td></tr><tr><td><p><code>jdbcUrl</code></p></td><td><p>String</p></td><td><p>The JDBC URL for the database server</p></td><td><p>Required</p></td><td></td></tr><tr><td><p><code>user</code></p></td><td><p>String</p></td><td><p>The username to use to connect to the database server</p></td><td><p>Required</p></td><td></td></tr><tr><td><p><code>pass</code></p></td><td><p>String</p></td><td><p>The password to connect to the database server</p></td><td><p>Required</p></td><td></td></tr><tr><td><p><code>eventsTable</code></p></td><td><p>String</p></td><td><p>The name of the table in which the agent stores the events</p></td><td><p>Optional</p></td><td><p><code>MULE_EVENTS</code></p></td></tr><tr><td><p><code>annotationsTable</code></p></td><td><p>String</p></td><td><p>The name of the table in which the agent stores the annotations associated with the main event</p></td><td><p>Optional</p></td><td><p><code>MULE_EVENTS_ANNOTATIONS</code></p></td></tr><tr><td><p><code>businessTable</code></p></td><td><p>String</p></td><td><p>The name of the table in which the agent stores the custom business events associated with the main event</p></td><td><p>Optional</p></td><td><p><code>MULE_EVENTS_BUSINESS</code></p></td></tr></tbody></table>

## MySQL Example Configuration

The following example shows how to set up the Runtime Manager agent to work with MySQL databases.

### Schema

```sql
CREATE TABLE MULE_EVENTS (
  id                  CHAR(36)     NOT NULL,
  action              VARCHAR(500) NULL,
  application         VARCHAR(500) NULL,
  mule_message        LONGTEXT     NULL,
  mule_message_id     VARCHAR(36)  NULL,
  notification_type   VARCHAR(500) NULL,
  path                VARCHAR(500) NULL,
  resource_identifier VARCHAR(500) NULL,
  timestamp           BIGINT       NOT NULL,
  source              TEXT         NULL,
  PRIMARY KEY (id)
);

CREATE TABLE MULE_EVENTS_ANNOTATIONS (
  id               CHAR(36)     NOT NULL,
  event_id         CHAR(36)     NOT NULL,
  annotation_type  VARCHAR(100) NULL,
  annotation_value VARCHAR(255) NULL,
  PRIMARY KEY (id),
  KEY FK_MULE_EVENTS_ANNOTATIONS_MULE_EVENTS_IDX (event_id),
  CONSTRAINT FK_MULE_EVENTS_ANNOTATIONS_MULE_EVENTS
  FOREIGN KEY (event_id) REFERENCES MULE_EVENTS (id)
    ON DELETE CASCADE
);

CREATE TABLE MULE_EVENTS_BUSINESS (
  id             CHAR(36)     NOT NULL,
  event_id       CHAR(36)     NOT NULL,
  business_key   VARCHAR(30)  NOT NULL,
  business_value VARCHAR(255) NULL,
  PRIMARY KEY (id),
  KEY FK_MULE_EVENTS_BUSINESS_IDX (event_id),
  CONSTRAINT FK_MULE_EVENTS_BUSINESS_MULE_EVENTS
  FOREIGN KEY (event_id) REFERENCES MULE_EVENTS (id)
    ON DELETE CASCADE
);
```

### Internal Handler Configuration

1.  Download the MySQL JDBC driver from:

    `[http://dev.mysql.com/downloads/connector/j/](http://dev.mysql.com/downloads/connector/j/)`

2.  Extract the ZIP file.

3.  Copy the `mysql-connector-java-{VERSION}.jar` file to
    `{MULE_HOME}/plugins/mule-agent-plugin/lib/modules`.

4.  Modify the file `{MULE_HOME}/conf/mule-agent.yml` to include the following:

    ```yaml
    mule.agent.tracking.handler.database:
      enabled: true
      driver: com.mysql.jdbc.Driver
      jdbcUrl: jdbc:mysql://192.168.61.128/mule
      user: root
      pass: test
    ```

## Oracle Example Configuration

The following example shows how to set up the Runtime Manager agent to work with Oracle databases.

### Schema

```sql
CREATE TABLE MULE_EVENTS (
  id                  CHAR(36)     NOT NULL,
  action              VARCHAR(500) NULL,
  application         VARCHAR(500) NULL,
  mule_message        CLOB         NULL,
  mule_message_id     VARCHAR(36)  NULL,
  notification_type   VARCHAR(500) NULL,
  path                VARCHAR(500) NULL,
  resource_identifier VARCHAR(500) NULL,
  timestamp           NUMBER       NOT NULL,
  source              CLOB         NULL,
  PRIMARY KEY (id)
);

CREATE TABLE MULE_EVENTS_ANNOTATIONS (
  id               CHAR(36)     NOT NULL,
  event_id         CHAR(36)     NOT NULL,
  annotation_type  VARCHAR(100) NULL,
  annotation_value VARCHAR(255) NULL,
  PRIMARY KEY (id),
  CONSTRAINT FK_MEA_ME
  FOREIGN KEY (event_id) REFERENCES MULE_EVENTS (id) ON DELETE CASCADE
);

CREATE INDEX FK_MAE_IDX ON MULE_EVENTS_ANNOTATIONS (event_id);

CREATE TABLE MULE_EVENTS_BUSINESS (
  id             CHAR(36)     NOT NULL,
  event_id       CHAR(36)     NOT NULL,
  business_key   VARCHAR(30)  NOT NULL,
  business_value VARCHAR(255) NULL,
  PRIMARY KEY (id),
  CONSTRAINT FK_MEB_ME
  FOREIGN KEY (event_id) REFERENCES MULE_EVENTS (id) ON DELETE CASCADE
);

CREATE INDEX FK_MEB_IDX ON MULE_EVENTS_BUSINESS (event_id);
```

### Internal Handler Configuration

1.  Download the Oracle JDBC driver from:

    `[https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html](https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html)`

2.  Extract the GZ file.

3.  Copy the JAR file to `{MULE_HOME}/plugins/mule-agent-plugin/lib/modules`.

4.  Modify the file `{MULE_HOME}/conf/mule-agent.yml` to include the following:

    ```yaml
    mule.agent.tracking.handler.database:
      enabled: true
      driver: oracle.jdbc.OracleDriver
      jdbcUrl: jdbc:oracle:thin:@192.168.61.128/XE
      user: root
      pass: test
    ```

## Microsoft SQL Server Example Configuration

The following example shows how to set up the Runtime Manager agent to work with Microsoft SQL
Server databases.

### Schema

```sql
CREATE TABLE MULE_EVENTS (
  id                  CHAR(36)     NOT NULL,
  action              VARCHAR(500) NULL,
  application         VARCHAR(500) NULL,
  mule_message        VARCHAR(MAX) NULL,
  mule_message_id     VARCHAR(36)  NULL,
  notification_type   VARCHAR(500) NULL,
  path                VARCHAR(500) NULL,
  resource_identifier VARCHAR(500) NULL,
  timestamp           BIGINT       NOT NULL,
  source              VARCHAR(MAX) NULL,
  PRIMARY KEY (id)
);

CREATE TABLE MULE_EVENTS_ANNOTATIONS (
  id               CHAR(36)     NOT NULL,
  event_id         CHAR(36)     NOT NULL,
  annotation_type  VARCHAR(100) NULL,
  annotation_value VARCHAR(255) NULL,
  PRIMARY KEY (id),
  CONSTRAINT FK_MULE_EVENTS_ANNOTATIONS_MULE_EVENTS
  FOREIGN KEY (event_id) REFERENCES MULE_EVENTS (id)
    ON DELETE CASCADE
);

CREATE INDEX FK_MULE_EVENTS_ANNOTATIONS_MULE_EVENTS_IDX ON MULE_EVENTS_ANNOTATIONS (event_id);

CREATE TABLE MULE_EVENTS_BUSINESS (
  id             CHAR(36)     NOT NULL,
  event_id       CHAR(36)     NOT NULL,
  business_key   VARCHAR(30)  NOT NULL,
  business_value VARCHAR(255) NULL,
  PRIMARY KEY (id),
  CONSTRAINT FK_MULE_EVENTS_BUSINESS_MULE_EVENTS
  FOREIGN KEY (event_id) REFERENCES MULE_EVENTS (id)
    ON DELETE CASCADE
);

CREATE INDEX FK_MULE_EVENTS_BUSINESS_IDX ON MULE_EVENTS_BUSINESS (event_id);
```

### Internal Handler Configuration

1.  Download the Microsoft JDBC driver for SQL Server from:

    `[https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774](https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774)`

2.  Extract the `sqljdbc%version%.tar.gz` file.

3.  Copy the appropriate `sqljdbc%version%.jar` file to
    `{MULE_HOME}/plugins/mule-agent-plugin/lib/modules`.

4.  Modify the file `{MULE_HOME}/conf/mule-agent.yml` to include the following:

    ```yaml
    mule.agent.tracking.handler.database:
      enabled: true
      driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
      jdbcUrl: jdbc:sqlserver://192.168.61.128:1433;databaseName=Mule;
      user: root
      pass: test
    ```

## See Also

- [Export Data to External Analytics Tools](https://docs.mulesoft.com/runtime-manager/sending-data-from-arm-to-external-analytics-software)

- [Servers, Server Groups, and Clusters](https://docs.mulesoft.com/runtime-manager/managing-servers)

- [Deploy to Your Servers](https://docs.mulesoft.com/runtime-manager/deploying-to-your-own-servers)

- [Manage Applications on Your Servers](https://docs.mulesoft.com/runtime-manager/managing-applications-on-your-own-servers)

- [Runtime Manager REST API](https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/f1e97bc6-315a-4490-82a7-23abe036327a.anypoint-platform/arm-rest-services)
