Set Up Peakhour Log Streaming with Google Cloud Observability#
This guide explains how to set up log streaming from Peakhour to Google Cloud Observability. By following these steps, you'll enable real-time security event monitoring and analysis in your Google Cloud environment.
Prerequisites#
Before you begin, ensure you have:
- A Peakhour account with administrator access
- A Google Cloud project with billing enabled
- Permissions to create service accounts, manage IAM roles, and configure logging in your Google Cloud project
Set Up Google Cloud#
Create a Log Storage Bucket#
- Go to the Google Cloud Console
- Navigate to "Logging" > "Logs Storage"
- Click "Create Log Bucket"
- Enter a name for your bucket (e.g., "peakhour-logs")
- Choose a location for your bucket
- Set the retention period as needed
- Click "Create Bucket"
Configure the Log Router#
- In the Google Cloud Console, go to "Logging" > "Log Router"
- Click "Create Sink"
- Name your sink (e.g., "peakhour-sink")
- For the sink destination, choose "Cloud Logging Bucket"
- Select the log bucket you created earlier
- In the "Build inclusion filter" section, enter a filter to capture Peakhour logs (e.g.,
logName="projects/[PROJECT_ID]/logs/peakhour-logs"
) - Click "Create Sink"
Create a Service Account#
- Navigate to "IAM & Admin" > "Service Accounts"
- Click "Create Service Account"
- Name the account "peakhour-log-writer"
- Grant it the "Logs Writer" role
- Click "Done"
Secure the Service Account#
- Go to "IAM & Admin" > "IAM"
- Find the "peakhour-log-writer" service account
- Click the pencil icon to edit its permissions
- Ensure it only has the "Logs Writer" role
- Remove any other roles or permissions
- Set conditions to restrict the service account:
- Click "Add Condition"
- Set a condition to limit access to specific IP ranges (e.g., Peakhour's IP addresses)
- Set a time-based condition to limit the validity period of the credentials
- Click "Save"
Generate a Key for the Service Account#
- Select the "peakhour-log-writer" service account
- Go to the "Keys" tab
- Click "Add Key" > "Create new key"
- Choose JSON format
- Download the key file
Note Your Google Cloud Project Details#
- Project ID
- Log ID (this will be the name of the log you specified in the log router sink)
- Organisation ID (if applicable)
Configure Peakhour#
- Log in to your Peakhour dashboard
- Navigate to "Log Forwarding" > "Google Cloud Observability"
- Enter the following information:
- API Key: Upload the service account key file
- Project ID: Your Google Cloud project ID
- Log ID: The ID of the log you specified in the log router sink
-
Organisation ID or Project ID: Enter your organisation ID if applicable, otherwise use your project ID
-
Click "Save Configuration"
Verify the Setup#
- Generate some test events in Peakhour
- Go to the Google Cloud Console
- Navigate to "Logging" > "Logs Explorer"
- Select your project and the log bucket you created
- You should see Peakhour events appearing in the log
Troubleshooting#
If you don't see logs: - Check the Peakhour configuration for typos - Ensure the service account has the correct permissions - Verify the log ID matches the one specified in your log router sink - Check the log router sink configuration for correct filters - Verify the service account conditions aren't blocking legitimate access
Next Steps#
Now that you've set up log streaming, you can: - Create custom queries in the Logs Explorer - Set up alerts for specific security events - Use Log Analytics to gain insights from your Peakhour data
For more information on working with logs in Google Cloud, refer to the official Google Cloud documentation.