This page describes the audit logs created by Stackdriver Monitoring as part of Cloud Audit Logging.
Google Cloud Platform services write audit logs to help you answer the questions, "Who did what, where, and when?" Your GCP projects each contain only the audit logs for resources that are directly within the project. Other entities, including folders, organizations, and billing accounts, each contain the audit logs for the entity itself.
Audited information is divided into different categories:
Admin Activity: Operations that modify the configuration or metadata of a resource.
Stackdriver Monitoring provides Admin Activity information by default.
Data Access (ADMIN_READ): Operations that read the configuration or metadata of a resource.
Stackdriver Monitoring does not provide Admin Read information by default.
Data Access (DATA_READ): Operations that read user-provided data from a resource.
Stackdriver Monitoring does not provide Data Read information by default.
Data Access (DATA_WRITE): Operations that write user-provided data to a resource.
Stackdriver Monitoring does not provide Data Write information by default.
Audit information that is not provided by default can be configured. For details, see Configuring Data Access Logs.
The following table lists the Stackdriver Monitoring API operations that are audited:
|Audit logs category||Stackdriver Monitoring operations|
|Admin activity logs||projects.groups.create
|Data Access logs (ADMIN_READ)||projects.metricDescriptors.get
|Data Access logs (DATA_READ)||projects.timeSeries.list|
|Data Access logs (DATA_WRITE)||projects.timeSeries.create
Audit log format
Audit log entries—which can be viewed in Stackdriver Logging using the Logs
Viewer, the API, or the SDK
gcloud logging command—include the following
The log entry itself, which is an object of type
LogEntry. Useful fields include the following:
logNamecontains the project identification and audit log type
resourcecontains the target of the audited operation
timeStampcontains the time of the audited operation
protoPayloadcontains the audited information
The audit information, which is an
AuditLogobject held in the
protoPayloadfield of the log entry.
Optional service-specific audit information, which is a service-specific object held in the
serviceDatafield of the
AuditLogobject. For details, see Service-specific audit data.
For other fields in these objects, sample contents of them, and sample queries on information in the objects, see Audit Log Datatypes.
Cloud Audit Logging log names indicate the project or other entity that owns the audit logs, and whether the log contains Admin Activity or Data Access information. For example, the following shows log names for a project's Admin Activity logs and an organization's Data Access logs.
Stackdriver Monitoring audit logs use the service name
For more details on logging services, see Mapping services to resources.
Stackdriver Monitoring audit logs use
the resource type
audited_resource for all
audit logs, because many different types of
resources can be monitored.
For a full list, see Monitored Resource Types.
Enabling audit logging
Admin Activity audit logs are enabled by default and cannot be disabled.
Data Access audit logs for BigQuery are enabled by default and cannot be disabled. The BigQuery Data Access logs do not count against your project's logging quota.
All other Data Access audit logs are disabled by default. To enable some or all of your Data Access logs, see Configuring Data Access Logs.
The Data Access logs that you configure can affect your logs pricing in Stackdriver. See the Pricing section on this page.
Audit log permissions
Cloud Identity and Access Management permissions and roles determine which audit logs you can view or export. Logs reside in projects and in some other entities including organizations, folders, and billing accounts. For more information, see Understanding Roles.
To view Admin Activity logs, you must have one of the following Cloud IAM roles in the project that contains your audit logs:
- Project Owner, Project Editor, or Project Viewer. See IAM Roles.
- Logging's Logs Viewer role.
- A custom Cloud IAM role with the
logging.logEntries.listCloud IAM permission.
To view Data Access logs, you must have one of the following roles in the project that contains your audit logs:
- Project Owner.
- Logging's Private Logs Viewer role.
- A custom Cloud IAM role with the
logging.privateLogEntries.listCloud IAM permission.
If you are using audit logs from a non-project entity, such as an organization, then change the Project roles to suitable organization roles.
To view audit logs for one of your projects, do one of the following:
View a summary of your Admin Activity logs in the Activity dashboard:
View all your audit logs using the Logs Viewer.
For more details, see the following options:
You can use the Logs Viewer basic interface to retrieve your audit log entries by doing the following:
- In the first menu, select the resource type whose audit logs you wish to see. Select a specific resource or all of them.
- In the second menu, select the log name you want to see:
activityfor Admin Activity audit logs and
data_accessfor Data Access audit logs. If you do not see one or both of those options, then there are no audit logs of that type available.
- Switch to the advanced filter interface in the Logs Viewer.
- Create a filter that specifies the resource type(s) and log names you want. For more information, see Retrieving audit logs.
To read your log entries through the Logging API, see entries.list.
To read your log entries using the Cloud SDK
gcloud command-line tool,
see Reading log entries.
Exporting audit logs
You can export audit logs in the same way you export other kinds of logs. For details about how to export your logs, see Exporting Logs. Here are some applications of exporting audit logs:
To keep audit logs for a longer period of time or to use more powerful search capabilities, you can export copies of your audit logs to Cloud Storage, BigQuery, or Cloud Pub/Sub. Using Cloud Pub/Sub, you can export to other applications, other repositories, and to third parties.
To manage your audit logs across an entire organization, you can create aggregated export sinks that can export logs from any or all projects in the organization.
- If your enabled Data Access logs are pushing your projects over their logs allotments, you can export and exclude the Data Access logs from Logging. For details, see Excluding Logs.
Stackdriver gives each GCP project a logs allotment of not less than 50 GB per month.
Audit logs that are enabled by default, including all Admin Activity logs, are free. They do not count against your logs allotment.
Data Access logs that you must explicitly enable do count against your logs allotment. Exceeding your allotment can result in additional charges or lost logs.
For pricing and logs allotment details, see Stackdriver Pricing: Logging Services.