(Note: much of this was taken from this public document: https://cloud.google.com/logging/docs/export/configure_export)
Events can be setup on a per-project basis by using Google Stackdriver Logging combined with Google Pub/Sub. Stackdriver logging is a service that aggregates and exposes log events from various other Google services and applications. This document describes how to export activity log entries for a Google project to Google Pub/Sub, a messaging service.
- You must have owner permission on the project you are exporting
- You must have enabled the Google Cloud Pub/Sub API for your project. You can enable the API via the following steps:
- Visit the API Library
- Search for "Pub/Sub" and click on the Google Cloud Pub/Sub API
- Click the Enable API button at the top of the screen
- The Stackdriver logging service must have permission to publish to your project’s Pub/Sub service. You can add permissions via the following steps:
- Navigate to the Permissions page in the Cloud Platform Console. If prompted, select your project.
- If account
cloud-logs@system.gserviceaccount.com
is already listed, then change its permission from Can view to Can edit. - If the account is not listed, then select Add Member:
1. Enter
cloud-logs@system.gserviceaccount.com
in the Email box 2. Select Can Edit under Permission 3. Select Add
You can setup exporting events for your Google project via the following steps:
- Go to the Logs Viewer and select a project
- Select the Exports tab at the left of the Logs Viewer screen. You should see something like this on the panel:
- In the Select service dropdown, select Compute Engine.
- In the Export these sources section, select Add item. Make sure
compute.googleapis.com/activity_log
is selected. - In the Select export destinations section, select the Publish to Cloud Pub/Sub topic dropdown and choose Add new topic...
- When prompted for a topic name, enter the name
manageiq-activity-log
- Confirm your panel looks like the panel pictured below:
- Click Save.
You’re finished! Now whenever changes occur to Compute Engine instances, ManageIQ will be notified and update its model appropriately.