How to Retrieve User Activity from GCP Logs
Quickly access user activity logs in GCP to assess potential security threats. Follow our guide to retrieve and review user activity efficiently.
Quickly access user activity logs in GCP to assess potential security threats. Follow our guide to retrieve and review user activity efficiently.
Being able to gather user activity in GCP is useful, whether you are dealing with a security incident or just want to fully audit the actions a user has taken.
For example, if you identify that a developer’s device has been compromised, you may want to review their activity in GCP to ensure that their keys were not used to exfiltrate data or make malicious changes.
In this guide, we’ll show you how to get a log of user activity from GCP to enable you to quickly pinpoint any suspicious actions.
In Google Cloud, many services automatically write back to audit logs designed to track activities in Google Cloud resources. The audit logs capture the following information:
Google Cloud audit logs differ from system logs used by programmers to troubleshoot errors. They instead document activities that companies track for compliance reasons or policy enforcement. The information captured in GCP logs varies depending on the organization, and the most significant benefit of GCP logs is that they make cloud environments as transparent as on-prem environments.
There are several ways you can go about getting someone's user activity in GCP.
Here are the steps to get a specific user’s audit logs using the GCP Console:
1. In the Console, go to Logging, and then Logs Explorer.
2. Next, choose if you want to look at a specific project, folder, or at your whole organization.
3. You can specify what logs you want to get using the Query builder. You can filter by parameters like resource type, resource labels, time range (e.g. last 1 hour, last 1 week, etc.).
You can also filter by these audit log types:
4. If you want to just query the activity for a specific user, you can type their email address into the search bar under the Query tab. This will show all logs related to the user since the field authenticationInfo.principalEmail is on each audit log record.
You can also run a query using this format if you prefer:
5. Next, export the logs by clicking Download and then selecting the max log entries to export and which format, JSON or CSV.
You can also use the gcloud logging read CLI command to get logs on a specific user:
Here’s an example command:
You can see more information about using additional log filters here.
If your team is responding to a security incident, retrieving user logs manually and adding them to a ticket could waste valuable time.
With Blink, you trigger an automation to pull GCP activity logs and other information for a compromised user right away and enrich the incident ticket.
This automation in the Blink library is set up as a self-service app, where a team member can specify input parameters and get all the activity logs sent to an email address.
When it runs, it executes the following steps:
You can import this automation from the library into your account and customize it based on your organization’s needs. For example, you can drag-and-drop new actions into the canvas or set up conditional subflows.
You can build your own automation from scratch or use one of our 5K automations in the Blink library today.
Get started with Blink today to see how easy automation can be.
Blink is secure, decentralized, and cloud-native. Get modern cloud and security operations today.