Create rules with the investigation tool
To help prevent, detect, and remediate security issues more quickly and efficiently, you can automate actions in the investigation tool by creating rules.
As an administrator, you can create a rule that alerts you or takes action based on any search that you configure in the investigation tool. After you configure the rule, Google will continuously perform a search that you have specified in the rule. If the number of results returned by that search exceeds the threshold that you have set up, then Google will perform the actions that you specify. For example, you can set up a rule to send email notifications to certain administrators if Drive documents are shared outside the company.
- To create and edit rules for a specific data source (for example, Gmail or Drive) you need the manage rules privilege and the update and delete privilege for that data source.
- To view rules for a specific data source (for example, Gmail or Drive), you need the view rules privilege and the view metadata and attributes privilege for that data source.
Create a rule from a search in the investigation tool
- Sign in to the Google Admin console at admin.google.com.
Be sure to sign in using your administrator account, and not your personal Gmail account.
- At the top, click Menu and select Security Investigation tool.
- Choose a data source for your search; for example, Device log events, Devices, Drive log events, or Gmail log events.
- Click ADD CONDITION.
You can include one or more conditions in your search. For details about conditions that are available for each data source, see Customize searches with the investigation tool.
- From the menu in the upper-right, select Create rule.
- Type a Rule name—for example, External data sharing—and type a Rule description—for example, Notify if documents are shared outside the company.
- Click NEXT: VIEW CONDITIONS.
You can view the search that you configured earlier, or you can continue making changes to your search. You can also click SEARCH to get a preview of your search results before continuing with the process of creating your rule.
- Click NEXT: ADD ACTIONS.
- Define a time period and a threshold for the rule. For example, you can configure a threshold of Every 24 hours when the count is greater than 100. This means for any given period of 24 hours, if your search returns more than 100 results, you want this rule to trigger.
- Choose whether or not you want this rule to trigger an alert in the alert center.
If you choose to turn on alerts for this rule, you can choose a severity of High, Medium, or Low. You can also choose to send email notifications by checking the All super administrators box, and/or by clicking ADD RECIPIENTS to send emails to select administrators when the rule is triggered.
- Click NEXT: REVIEW.
Use this page to review all of the details of the rule and to make any changes, if needed, before creating the rule.
- Click CREATE RULE.
View rule details
After you have created a rule using the investigation tool, you’re directed to the Rule details page, where you can review the rule’s details and scope, the conditions for the rule, and the actions that are triggered when thresholds are met.
The Rule details page also includes breadcrumbs in the upper-left corner:
Security > Activity rules > Rule details
Click Activity rules to see a list of all rules that have been created by all administrators in your domain.
From the Activity rules page, administrators within your domain are able to view rules created by other administrators, depending on the data source for the rule and the privileges of each administrator. For example, an administrator might have view privileges for Drive log events, but not for Gmail log events, and therefore they’re unable to view any rules that are based on Gmail log events.
You can use the Activity rules page to take the following actions:
- Delete rules.
- Filter the list of rules by clicking Add a filter.
- Click ADD NEW RULE to create new rules. This takes you through the same process described above, which enables you to create a rule based on a search in the investigation tool.
If you set up email notifications for your rule, emails are sent to specified recipients when the rule is triggered. The email notification contains a summary of the rule that triggered the alert, including the rule name, the threshold details, source data, and more. Administrators who receive the email notification can click VIEW ALERT to be taken to the Alert details page in the alert center.