This guide walks you through preparing your Google Cloud environment so SOCFortress can collect your GCP logs into your SIEM. You'll create a place for your logs to be delivered (a Pub/Sub topic and subscription), route your logs there (a log sink), and create a dedicated service account with a key that our Wazuh platform uses to read them.
At the end there's a short test you can run yourself to confirm everything works before you send anything to us.
Time required: about 20–30 minutes.
acme-prod-123456
socfortress-wazuh-logs-sub
socfortress-wazuh-key.json
Treat the JSON key like a password. Never send it over plain email. Upload it through the secure channel SOCFortress provides (for example, your OneHub folder).
You'll need:
Common blocker: some organizations block service account key creation with the organization policy iam.disableServiceAccountKeyCreation. If you get an error when creating the key in Step 6, your GCP organization administrator will need to allow key creation for this project.
iam.disableServiceAccountKeyCreation
In the commands below, replace these placeholders with your own values:
PROJECT_ID
TOPIC_ID
socfortress-wazuh-logs
SUBSCRIPTION_ID
SINK_NAME
socfortress-wazuh-sink
SA_NAME
socfortress-wazuh
Console: your Project ID is shown in the project picker at the top of the console. Then go to APIs & Services > Libraryand make sure Cloud Pub/Sub API and Cloud Logging API are enabled.
gcloud:
gcloud config set project PROJECT_ID gcloud services enable pubsub.googleapis.com logging.googleapis.com
The topic is where your logs are delivered.
Console:
gcloud pubsub topics create TOPIC_ID
The subscription is what our platform reads from. If the console already created a default subscription in Step 2, open it and confirm its Delivery type is Pull, then note its Subscription ID and skip ahead.
gcloud pubsub subscriptions create SUBSCRIPTION_ID \ --topic=TOPIC_ID \ --message-retention-duration=7d
Use this subscription only for SOCFortress. If anything else reads from it, those logs will never reach your SIEM.
The log sink tells Cloud Logging which logs to send to the topic.
We recommend starting with Cloud Audit Logs. They cover who did what in your GCP environment and carry the most security value. Copy this inclusion filter exactly:
logName=~("projects/.*/logs/cloudaudit.googleapis.com%2F(activity|data_access|system_event|policy)")
Important: a sink with no filter exports every log in your project. That can be very large volume and cost. Always set an inclusion filter.
Optional additional sources. Add these to the filter (combined with OR) only if you want them, and coordinate with SOCFortress first:
OR
resource.type="dns_query"
resource.type="gce_subnetwork" AND log_name="projects/PROJECT_ID/logs/compute.googleapis.com%2Fvpc_flows"
resource.type="gce_subnetwork" AND log_name="projects/PROJECT_ID/logs/compute.googleapis.com%2Ffirewall"
resource.type="http_load_balancer"
Some of these logs have to be switched on at the source before they exist:
gcloud dns policies create POLICY_NAME --networks=NETWORK_NAME --enable-logging --description="SOCFortress DNS logging"
gcloud logging sinks create SINK_NAME \ pubsub.googleapis.com/projects/PROJECT_ID/topics/TOPIC_ID \ --log-filter='logName=~("projects/.*/logs/cloudaudit.googleapis.com%2F(activity|data_access|system_event|policy)")' \ --description="SOCFortress Wazuh log export"
Multiple projects? A project-level sink only exports that project's logs. To cover several projects with one sink, your organization administrator can create an aggregated sink at the folder or organization level (--organization=ORG_ID --include-children) that points to this same topic. Let us know if you go this route.
--organization=ORG_ID --include-children
Each sink has its own Google-managed identity (its writer identity), and that identity needs permission to publish to your topic. If you created the sink in the console with the topic in the same project, Google usually grants this automatically. Check it either way.
Find the writer identity:
serviceAccount:service-123456789012@gcp-sa-logging.iam.gserviceaccount.com
gcloud logging sinks describe SINK_NAME --format='value(writerIdentity)'
Grant it Pub/Sub Publisher on the topic:
serviceAccount:
gcloud pubsub topics add-iam-policy-binding TOPIC_ID \ --member='WRITER_IDENTITY' \ --role='roles/pubsub.publisher'
A few minutes after this, logs should start flowing into the topic.
This is the account our Wazuh platform uses to read from your subscription.
gcloud iam service-accounts create SA_NAME \ --display-name="SOCFortress Wazuh integration" gcloud projects add-iam-policy-binding PROJECT_ID \ --member="serviceAccount:SA_NAME@PROJECT_ID.iam.gserviceaccount.com" \ --role="roles/pubsub.subscriber" gcloud projects add-iam-policy-binding PROJECT_ID \ --member="serviceAccount:SA_NAME@PROJECT_ID.iam.gserviceaccount.com" \ --role="roles/pubsub.publisher" gcloud iam service-accounts keys create socfortress-wazuh-key.json \ --iam-account=SA_NAME@PROJECT_ID.iam.gserviceaccount.com
The key is a JSON file containing fields such as "type": "service_account", "project_id", "private_key" and "client_email". Don't edit it.
"type": "service_account"
"project_id"
"private_key"
"client_email"
Run this from Cloud Shell or any machine with the gcloud CLI. It logs in as the new service account and reads from the subscription, which is exactly what our platform will do.
Upload the key (in Cloud Shell, use the ⋮ > Upload menu) and authenticate as the service account:
gcloud auth activate-service-account --key-file=socfortress-wazuh-key.json --project=PROJECT_ID
Expected: Activated service account credentials for: [socfortress-wazuh@PROJECT_ID.iam.gserviceaccount.com]
Activated service account credentials for: [socfortress-wazuh@PROJECT_ID.iam.gserviceaccount.com]
Generate some activity so there's an audit log to see. For example, open a few pages in the console or list your buckets.
Pull from the subscription. Do not add --auto-ack. Without it, the messages stay in the subscription and are still delivered to us later.
--auto-ack
gcloud pubsub subscriptions pull SUBSCRIPTION_ID --limit=5 --project=PROJECT_ID
Switch back to your own account when you're done:
gcloud auth revoke SA_NAME@PROJECT_ID.iam.gserviceaccount.com gcloud config set account YOUR_USER_EMAIL
DATA
Listed 0 items.
PERMISSION_DENIED
NOT_FOUND
Only the first test (activation plus a pull with messages) needs to pass. You don't need any Wazuh software for this.
Once the test passes, send us:
We'll configure the integration on our side and let you know once your GCP logs are visible in your SIEM.
Wazuh can also read Cloud Storage usage and storage logs (bucket access logs) directly from a bucket. This is separate from the Pub/Sub method above and only covers bucket access logs. If you want it, let us know and we'll send the extra steps. In short: a log bucket with Cloud Storage logging enabled, and a service account with Storage Object User and Storage Insights Collector Service.
Wazuh
Google Cloud
gcloud auth activate-service-account
gcloud pubsub subscriptions pull
Questions? Reply to your support case and we'll help.
Was this article helpfu?
Thank you for voting
You are related to multiple companies. Please select the company you wish to login as.