How to Get User Creation Events from GCP Logs
Learn how to find and retrieve user creation events from GCP logs to monitor security and manage user access effectively in your cloud environment.
Learn how to find and retrieve user creation events from GCP logs to monitor security and manage user access effectively in your cloud environment.
One part of securing your GCP account is by monitoring user creation events since bad actors may try to expand their access. These events in your GCP logs are the record of actions for when new users are created, including information like when, by whom, by with what permissions.
In this guide, we’ll show you how to get user creation events from your GCP logs.
You can retrieve User Creation Events from GCP Logs in two ways: Google Cloud Command Line Interface (gcloud CLI) or Google Cloud Console (GCP Console).
resource.type=audited_resource AND protoPayload.methodName=google.cloud.iam.credentials.v1.CreateIAMUserKey AND jsonPayload.event_subtype=google.cloud.iam.credentials.v1.user_key.create
Access your GCP account by typing
Or
gcloud auth application-default login
Use the following command to set your default project, with <PROJECT_1> indicating your project ID:
To retrieve the User Creation Events from GCP Logs type:
This command will find the most recent 50 entries of user activities from the log data. You can change the --limit parameter to retrieve fewer or more entries.
You can also write the above command by adding the --format option and file path. Type:
This command will save the output to a file named user_creation_events.json.
The above step is for retrieving User Creation Events from default GCP logs. If you are looking for user activity records in another log, you can specify a name for a log by using the option --log-name.
Using the Google Cloud Reports API:
You can also get user creation events by calling the Google Cloud Reports API with the activities.list method, and specifying the eventName=CREATE_USER.
You can run a GET request like this for all user creation events across your account:
If you want to search if a certain user has created new users, you can specify a primary email address in the GET request like this:
If you are dealing with a security incident and a compromised account, these results will enable you to better understand the scope of a risk.
With Blink, you can run this automation to quickly get this information.
This GCP automation in the Blink library makes getting this information easy. When you input the time range you want information for, the automation does the following steps:
It is a simple automation, but it can also be incorporated into more complex workflows. For example, what if you want to pull user creation events automatically as part of an incident response process? You can add this automation as a subflow that is kicked off whenever suspicious GCP activity is detected.
You could also set up a regular scan of user creation events and verify them against your other tools to ensure that no one external has received unauthorized access.
It’s easy to import this automation from the library into your Blink account and customize it based on your organization’s needs. Just drag-and-drop new actions into the canvas or set up no-code conditional subflows.
Build your own automations from scratch or use one of the 5K pre-built automations in the 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.