In many organizations, logs may contain sensitive information that requires scrubbing or restricted access to ensure compliance and privacy. Role-Based Access Control (RBAC) enables you to manage user access permissions efficiently, allowing only authorized personnel access to specific logs and features. This guide details how to set up RBAC for logs in Datadog, focusing on creating custom roles and assigning appropriate permissions.
Consider an organization with multiple teams, such as the ACME team, which handles ACME logs for troubleshooting and auditing. Within the ACME team, there are two primary user categories:
ACME Admin: These users manage ACME log collection, pipelines, and exclusion filters.
ACME User: These users access ACME logs and create monitors or dashboards based on these logs.
You can customize this setup to fit your organizational needs, either by consolidating permissions into a single role or creating multiple roles for more detailed access control. The principles outlined here can be adapted to other teams within your organization.
In Datadog, permissions are additive; users belonging to multiple teams benefit from combined permissions across all assigned roles.
As a Datadog Admin, you can configure a secure environment for ACME team members to manage their logs without affecting logs from other teams. This guide explains the steps for setting up roles and permissions to restrict log access to ACME Users specifically. You can also adapt the setup to make ACME Admins serve as Datadog Admins if needed.
First, tag incoming ACME logs with a team:acme tag, which helps in categorizing logs as they pass through Datadog. For instance, when collecting Docker logs, apply the team:acme tag using Docker labels as tags.
To perform the actions in this guide, you must have Datadog Admin permissions. Ensure your user account can create roles, assign users, and manage Log Pipelines, Log Indexes, and Log Archives. For more information on permissions, see Datadog Role Permissions
Navigate to the Users list to verify that you have all these permissions. If these permissions are missing, request them from a current Datadog Admin.
If you plan to use the Datadog API, you need an API key and an app key from an Admin user. API keys and app keys can be generated in your organization settings. Ensure the app key is associated with a user who has the necessary permissions. For more information, see API and app keys.
In this guide, replace <DATADOG_API_KEY> and <DATADOG_APP_KEY> with your Datadog API key and application key, respectively. A terminal with CURL is also required.
Note: This section is only required if you intend on using the Datadog API to set up RBAC.
If you plan to use the Datadog API, use the Permissions API to get all existing permissions. You need the permission ID for actions such as granting roles specific permissions. Note: The permission IDs change depending on your selected Datadog site (US1).
Grant ACME Team members access to team:acme logs exclusively by using the logs_read_data permission with Restriction Queries.
For best practices, avoid extending ACME Users’ permissions to access additional logs. Also, avoid applying the same team:acme restriction query to other roles. Instead, assign users to multiple roles based on their individual access needs.
This section details how to:
Create a team:acme restriction query.
Attach that restriction query to ACME roles.
Note: Each role can have only one restriction query attached. Attaching a new restriction query to a role replaces any existing query for that role.
Grant the ACME Admin role permissions to manage Log Pipelines, Log Indexes, and Log Archives without impacting other teams.
This ensures that:
ACME Admin members (and only ACME Admin members) can interact with ACME Log Assets.
Neither ACME Admin nor ACME User members can interfere with assets from other teams.
Neither ACME Admin nor ACME User members can interfere with higher level “Admin” configurations, such as which logs flow into their assets, budget limitations, or Log Access Restriction rules.