I often receive the question - how can I get alerted when a developer creates an App in the Apigee developer portal?
It’s obvious why someone would want to get an alert. Maybe they have the developer app set to “Manual Approval” and they want to interactively evaluate the request for credentials. Maybe there is an automated workflow that must kick off to provision the app beyond just getting the Apigee generated credentials. Maybe there’s some other reason. But for whatever governance purpose, people want to know when developers register !
It’s really easy to set this up for Apigee X and hybrid. I’ll review the idea here, and then share a demonstration of how it works below.
When a developer signs in to an Apigee developer portal, and then requests a new app, that results in a call from the Developer Portal backend into the control plane of Apigee, saying “Create a new app for THIS developer, authorized for THIS set of API products.” The Apigee control plane performs that work and then sends back the response including the credentials.
As with all update operations performed through the Apigee control plane, the creation of a new developer app is Audited. This means there’s a log record stored into Google Cloud Logging that describes this change. Cloud Logging is part of the Cloud Operations suite, which includes Monitoring, alerting, Logging and more.
In Google cloud, it’s super simple to set up an alert based on the content of a log record. The first step: Go into Log Explorer, perform the query you want. In this case, to search the logs for records indicating creation of a new developer app, the query should be:
protoPayload.methodName:"google.cloud.apigee.v1.DeveloperApps.CreateDeveloperApp"
You should see the log records in the lower part of the screen, under the label “Query results”.
After that, Click the “Create alert” button.
*The user creating the alert needs the appropriate permissions. To get the required permissions, you can attach these roles to the user:
- Logging Admin
- Monitoring AlertPolicy Editor
Confirm the condition for the alert - it should auto-populate with the same thing you used in your query. Then specify the notification channel; your options here are PagerDuty, Slack, email, SMS, Webhook, and more. After that, you’ll be alerted via that channel, when a matching log record appears in the audit log. In other words, you will be alerted via the channel of your choice when a developer creates an app in the portal!
You can see a working demonstration here.
