Oracle Cloud Infrastructure Documentation

Managing Rules for Events

This topic describes how to manage rules for the Events service. For more information about Events, see Overview of Events.

Prerequisites for Creating Rules

  • Action resources: You must have resources already set up to specify as an action. The Events service invokes the action specified in the rule by delivering the event message to action resources, which can include (Notifications service) A communication channel for sending messages to the subscriptions in the topic., streams, or functions. Every rule must have at least one action. The Events service can invoke any of the following services by delivering an event message for processing: 

  • IAM policies: To manage or list rules, you must be given the required type of access in a An IAM document that specifies who has what type of access to your resources. It is used in different ways: to mean an individual statement written in the policy language; to mean a collection of statements in a single, named "policy" document (which has an Oracle Cloud ID (OCID) assigned to it); and to mean the overall body of policies your organization uses to control access to resources. written by an administrator, whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you try to perform a task and get a message that you don’t have permission or are unauthorized, confirm with your administrator the type of access you've been granted and which A collection of related resources that can be accessed only by certain groups that have been given permission by an administrator in your organization. you should work in. For more information, see Events and IAM Policies.

  • Event messages: To create rules, the resources you want to monitor with the rule must emit events. For more information, see Services that Produce Events.

Working with Rules

Warning

Avoid entering confidential information when assigning descriptions, tags, or friendly names to your cloud resources through the Oracle Cloud Infrastructure Console, API, or CLI.

A typical workflow for setting up rule might follow this pattern: 

  1. Identify action resources

    Set up or identify whatever action resources you intend to use with the rule. For example, you might set up a Notifications topic and create subscriptions for the DevOps team so that they are notified when backups complete. If a topic already exists, you can use it instead of creating a topic. The resources you specify for actions do not have to be in the same compartment as the rule.

  2. Plan filtering

    Ensure the resources that you want to monitor emit events to the Events service and plan your pattern matching strategy. For example, you might want to monitor backups on Autonomous Data Warehouse instances in the ABC compartment. Ensure Autonomous Data Warehouse instances emit an event type you can use to create the automation you require. Review the example JSON event to determine the best way to identify those resources in filters. See Matching Events with Filters and Services that Produce Events.

  3. Create the rule

    Rules apply to events in the compartment in which you create them and any child compartments. Create a rule in the compartment with the resource you want to monitor and specify where to deliver matching events. For example, in the ABC compartment, you might create a rule that filters for Autonomous Data Warehouse backup events. Since Events has no requirement about the location of action resources, you could specify a topic in the XYZ compartment as the resource to deliver any matching events.

Managing Tags for Rules

You can add tags to your resources to help you organize them according to your business needs. You can add tags at the time you create a resource, or you can update the resource later with the desired tags. For general information about applying tags, see Resource Tags.

Tags and Event Filtering

With Events, you can also use tags to target resources in your tenancy. You target resources by adding the tag to a filter in a rule. A filter tag helps you hone automation by targeting only resources that contain a particular tag. For example, let's say you have dozens of Database instances in your tenancy, but only a few of the most critical of these instances have the tag "Operations." You could create a rule that triggers a particular action for resources that only contain the "Operations" tag.

Policy for working with filter tags is no different from policy for working with tags.

To manage filter tags
To manage tags for rules

Move Rules to a Different Compartment

You can move rules from one compartment to another. When you move a rule to a new compartment, you stop monitoring events from resources in the current compartment and begin monitoring events in the new compartment (and any child compartments). After you move the rule to the new compartment, inherent policies apply immediately and affect access to the rules through the Console. Moving rules doesn't affect access by the Events service to actions defined in rules. For more information, see Moving Resources to a Different Compartment.

Monitoring Rules

You can monitor the health, capacity, and performance of your Oracle Cloud Infrastructure resources by using metrics, alarms, and notifications. For more information, see Monitoring Overview and Notifications Overview.

For more information about monitoring the rules you create, see Events Metrics.

Object Events and the Events Service

Events for objects are handled differently than other resources. Objects do not emit events by default. Use the Console, CLI, or API to enable a bucket to emit events for object state changes. You can enable events for object state changes during or after bucket creation.

Using the Console

To create a rule
To edit a rule
To disable or enable a rule
To move a rule to a different compartment
To validate a rule
To delete a rule
To add an action to a rule
To edit an action
To enable or disable an action
To remove an action
To add event types to a rule
To edit event types for a rule
To remove event types for a rule
To add attributes to a rule
To edit attributes for a rule
To remove attributes for a rule
To add filter tags to a rule
To edit filter tags for a rule
To remove filter tags for a rule

Using the Command Line Interface (CLI)

When you use the CLI to create a rule, you work a little differently than using the Console.

  • To specify the actions for your rule, use a JSON formatted file. You create this file before you create the rule, and the file simplifies the amount of information you must type at the command line.
  • To specify an event to match, use a JSON formatted string. You type this right into the console as you create the rule.

For information about using the CLI, see Command Line Interface (CLI). For a complete list of flags and options available for CLI commands, see CLI Help.

To create an action JSON file
To create a rule
To delete a rule
To get rule metadata
To get a list of rules
To update a rule

Using the API

For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.

Use the following operations to manage rules: