16.3 Connector Hub: Moving Logs, Metrics, Queue Messages & Streams Between Services
Key Takeaways
A Connector Hub connector defines a source service, optional tasks, and a target service, and connectors run continuously.
Connector Hub sources are Logging, Monitoring, Queue, and Streaming.
The log filter task is available only for a Logging source, while a Functions task can process data from any source except for a few Notifications combinations.
Connector Hub delivers each batch at least once and retries a failed move before moving later batches.
Messages larger than 128 KB sent to a Notifications target are dropped.
What Connector Hub Does
Connector Hub, formerly Service Connector Hub, is a cloud message bus for moving data between OCI services. Instead of writing and running code to copy logs to a bucket or forward metrics to a SIEM, you define a connector:
- Source: where the data comes from.
- Tasks (optional): a log filter task to select log entries, or a Functions task to transform data.
- Target: where the data goes.
Connectors run continuously, and data moves in a sequence of move operations. Delivery speed depends on the source, task, target, and their service limits. For example, a Logging-to-Notifications move takes up to a few minutes, and a Streaming source with a Functions task and Object Storage target can take up to about 17 minutes depending on batch settings.
Sources and Targets
| Source | Functions | Log Analytics | Monitoring | Notifications | Object Storage | Streaming |
|---|---|---|---|---|---|---|
| Logging | Yes | Yes | Yes | Yes | Yes | Yes |
| Monitoring | Yes | No | No | No | Yes | Yes |
| Queue | Yes | No | No | Yes, without a Functions task | Yes | Yes |
| Streaming | Yes | Yes | No | Yes, without a Functions task | Yes | Yes |
Targets behave differently: Functions processes data; Log Analytics, Monitoring, Object Storage, and Streaming store it; and Notifications delivers it to topic subscriptions.
Source Details
- Logging: select one or more logs or log groups, including the
_Auditlog group. The Logging source has a 24-hour retention period in Connector Hub. - Monitoring: select metric namespaces in one or more compartments; metric data points are aggregated before delivery. Retention is also 24 hours.
- Queue: messages are written to the target and then automatically deleted from the queue.
- Streaming: retention is the stream's own retention period, which you define.
Tasks
- The log filter task is supported only for a Logging source. It uses the Logging query syntax, a
searchscope plus awherecondition, such as entries whosedata.statusCodeis 500 or higher. It does not use JMESPath or SQL. - A Functions task sends batches to a function for custom processing, such as masking personal data, enriching records, or converting formats. The task returns processed data to Connector Hub, which writes it to the target. A Functions task is not supported for Queue or Streaming sources with a Notifications target.
Delivery, Retries, and Batching
- Connector Hub follows at-least-once delivery: each batch is delivered at least once, so targets may see duplicates and should handle them.
- If a move fails, the connector retries it and does not move later batches until the retry succeeds.
- If failures continue beyond the source's retention period, that batch is not delivered. For Logging, data generated more than 24 hours earlier can be skipped after a long outage.
- The Notifications target accepts messages up to 128 KB; larger messages are dropped.
- Batch settings exist for a Functions task, Functions target, and Object Storage target. You can set a batch size and a batch time, and whichever limit is reached first triggers the flush. For example, with 1 MB and 10 seconds, a batch is sent when 1 MB has accumulated or 10 seconds have passed.
Failing and Updated Connectors
- A connector that keeps failing with 404 errors, or 502 errors from a function, triggers a warning announcement after four consecutive days and is automatically deactivated after seven days. Fix the configuration and reactivate it, and enable connector logs to see the data flow.
- Updating a connector's source, task, or target resets it internally, so it may not resume from its previous position and may reprocess data. Oracle recommends creating a new connector when the source or target must change.
IAM for Connectors
A connector acts as its own principal (request.principal.type = 'serviceconnector'). When you create or edit a connector in the Console, default policies are offered for its source, task, and target. For example, an Object Storage target gets:
Allow any-user to manage objects in compartment id <bucket_compartment_ocid> where all {request.principal.type='serviceconnector', target.bucket.name='<bucket_name>', request.principal.compartment.id='<connector_compartment_ocid>'}
For narrower access, create a dynamic group that matches connectors, such as All {resource.type = 'serviceconnector', resource.compartment.id = '<compartment_ocid>'}, and write policies for that dynamic group. A Logging source has no default policy: the person creating the connector needs read access to the logs. Automatically created policies remain after a connector is deleted, so delete them as part of cleanup.
Common Designs
| Requirement | Connector design |
|---|---|
| Keep logs for years for compliance | Logging source (including _Audit), Object Storage target, plus bucket lifecycle rules to Archive storage |
| Alert on specific log events | Logging source, log filter task, Notifications target |
| Count log events as a metric for alarms | Logging source, log filter task, Monitoring target, then an alarm on the new metric |
| Send security events to an external SIEM | Logging source, Streaming target; the SIEM consumes the stream |
| Mask personal data before archiving | Streaming or Logging source, Functions task, Object Storage target |
| Export metrics for long-term analysis | Monitoring source, Object Storage target |
| Process queue messages with code | Queue source, Functions target |
Design Example: Alerting on IAM Policy Changes
A security team wants an email whenever someone creates, updates, or deletes an IAM policy:
- Create a connector with the Logging source set to the
_Auditlog group of the relevant compartments. - Add a log filter task whose
wherecondition matches the policy event types, for example a type containingidentitycontrolplaneandpolicy. - Set the target to a Notifications topic with an email subscription for the security team.
- Accept the default policy offered for the topic.
To count changes over time instead of sending one email per event, send the filtered entries to a Monitoring target and create an alarm on the resulting metric.
A team wants only the Load Balancer log entries with HTTP 5xx status codes to be sent to a Notifications topic. Which connector design meets this with the least custom code?
Logging source with a log filter task that selects 5xx entries, and a Notifications target
Monitoring source with a Functions task, and a Notifications target
Streaming source with a log filter task, and a Notifications target
Logging source with no task, and a Notifications target configured to drop non-5xx messages
A connector moves application logs to a function target. The function was misconfigured for two days and every move failed. After the fix, the team sees that logs from the first day never arrived. Why?
Connector Hub delivers each batch at most once, so failed batches are discarded
The connector skipped the failed batches and kept moving later batches while the function was down
Function targets accept at most 128 KB per message, so larger batches were dropped
Logging data is kept for only 24 hours as a source, so batches that failed longer were lost
A security team must keep all audit events for seven years and wants them stored as cheaply as possible. Which design fits?
Increase the tenancy's Audit log retention setting from 365 days to seven years
Move _Audit logs to Object Storage with a connector and use lifecycle rules for Archive
Send the _Audit log group to a Notifications topic that emails the security team
Send audit events to a Monitoring target and keep the resulting custom metrics for seven years
Sections you finish are checked off in the contents.