Documentation Index
Fetch the complete documentation index at: https://backstage.spotify.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Set the API token
The audit log API token is a static token configured to grant your caller service access to the API endpoint.- As an admin user, go to “App Settings” in the left-hand menu under “Admin.”
- Navigate down to the “External access” section.
- Open the entry titled
audit-log-api-access, which is a static token that has been pre-created for you with the recommended settings.
Tip: By default, we use access restrictions to restrict the token’s scope to theaudit-logplugin andaudit.log.readpermission. Tokens with different plugin or permission scope will cause API requests to respond with 403 Forbidden.
- In the “Token” section, paste in a secure API token value of your choice for API authentication. Keep this value in a safe place as you won’t be able to see it in Portal.
Tip: The token must be at least 8 characters long and not contain spaces. Withnode, you can generate a token in the Terminal via the command:node -p 'require("crypto").randomBytes(24).toString("base64")'
- Click “Update item” in the bottom right corner.
- Click “Save” in the bottom right corner and wait for Portal to reload with the new configuration.
Exclude certain events or actors from logs
In Portal’s App Settings, you can configure which combinations of actor and event you want to exclude from being saved to the audit trail. By default,entity-fetch and entity-facets events from all plugin actors are excluded because they are high-volume, low-value read operations. The same events from synthetic test users are also excluded to prevent noise.
Important: Exclusion rules prevent events from being saved to the audit log database entirely. They will still appear in console logs (if the severity level is configured to log), but will not be queryable via the API.
- As an admin user, go to “Plugins” in the left-hand menu under “Admin.”
- Find the “Audit Log” plugin card in the list and open it.
- Add or edit exclusion rules in the UI using the configuration format shown in examples below.
- Save your changes.
Example Use Cases
Wildcard Patterns
Use wildcards (*) in actorId to exclude patterns of events:
plugin:*- Matches all plugin actorsplugin:search- Matches only the search pluginuser:*/*- Matches any user in any namespaceuser:default/*- Matches any user in the default namespace
Add audit events to custom plugins
Save events taking place in your own custom plugins by integrating the Backstage auditor service.Integrate auditor service
Declare the auditor service as a plugin dependency:Add audit events
Use thecreateEvent method to generate audit events. For more on how to use the auditor service, see the Auditor Service Backstage documentation (specifically Naming conventions) and the AuditorService source code.
Automatic field extraction
ThePortalAuditorService automatically extracts the following information:
- Actor ID & Type: From request credentials (user or service principal)
- Request Method & URL: From the Express request object
- Plugin ID: From the plugin metadata
- Event Time: Current timestamp
Special meta fields
The following fields in themeta object are promoted to dedicated database columns to be queried by the API easily. These fields are removed from the meta JSON blob to avoid duplication.
actionTypequeryTypeentityRef