Scenario: Sending Log Data to an Autonomous Database

Send log data from Logging to an Autonomous Database using a function (Functions service).

This scenario involves creating a function and then referencing that function in a connector (Connector Hub)  to process and move log data from Logging to an Autonomous Database.

Required IAM Policy

If you're a member of the Administrators group, you already have the required access to execute this scenario. Otherwise, you need access to Functions.

The workflow for creating the connector includes a default policy when needed to provide permission for writing to the target service. If you're new to policies, see Getting Started with Policies and Common Policies.

Setting Up This Scenario

This scenario involves creating a connector (Connector Hub)  to send log data from Logging to an Autonomous Database (JSON).

Before you can create the connector, you must set up an Autonomous JSON Database that you want to receive the log data and set up the function to copy that log data.

Autonomous JSON Database setup details:

  • Provision Autonomous Database
  • Duplicate the browser tab.
  • In the duplicated tab, copy the ORDS base URL: From the details page for the Autonomous Database, select Service Console, select Development, and then select Copy under RESTful Services and SODA.'
  • Create a "logs" collection to store the log data that will be moved by the function and connector:
    1. Go back to the details page for the Autonomous Database (the original browser tab).

    2. Select Database Actions.

    3. Log in with the admin user and the password you set when you created the database.

      The Database Actions | Launchpad window is displayed.

    4. Select SQL.

      The Database Actions | SQL window is displayed.

    5. Enter the following command:

      soda create logs
    6. Select Run Statement (Run Statement).

    To query documents in the collection after the connector copies log data, enter the following command:

    soda get logs -f {}

Function setup details:

Once the database and function are set up, you're ready to create the connector. Creating the connector is easy in the Console. Alternatively, you can use the Oracle Cloud Infrastructure CLI or API, which lets you execute the individual operations yourself.

Using the Console

This section walks through creating a connector using the Console. Your function must be deployed.

For help with troubleshooting, see Troubleshooting Connectors.

Using the CLI

This section walks through creating a connector using the CLI that moves log data to your function (which then moves the data to an Autonomous Database).

For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.

  • Create a connector: Open a command prompt and run the oci sch service-connector create command:

    Command
    oci sch service-connector create --display-name
    "<display_name>" --compartment-id <compartment_OCID> --source [<source_in_JSON>] --tasks [<tasks_in_JSON>] --target [<targets_in_JSON>]

For help with troubleshooting, see Troubleshooting Connectors.

Using the API

This section walks through creating the connector using the API.

For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.

Use the following operations:

  • CreateServiceConnector: Create a connector that moves log data to your function (which then moves the data to an Autonomous Database).

For help with troubleshooting, see Troubleshooting Connectors.