Great that you identified the root cause! Let me provide a comprehensive solution for anyone facing similar VPC Flow Logs direction issues:
1. VPC Subnet Configuration Check:
First, verify your subnet is properly attached to the VPC and has active network interfaces. Use:
ibmcloud is subnet SUBNET_ID --output json
Confirm the subnet status is ‘available’ and network_interfaces array is populated.
2. Flow Log Direction Settings:
When creating flow logs in ic-2019, you need to ensure bidirectional capture. If your flow log was created with older CLI versions, recreate it with explicit parameters:
ibmcloud is flow-log-create my-vpc-flowlog \
--target subnet-abc123 \
--bucket my-logging-bucket \
--active true
Note: The CLI defaults to all traffic, but verify with ibmcloud is flow-log FLOW_LOG_ID that no direction filters exist.
3. IAM Permissions for Logging (Critical):
This is where your issue was. The flow log service needs proper authorization:
a) Service-to-service authorization:
ibmcloud iam authorization-policy-create is \
cloud-object-storage Writer \
--source-service-instance-id VPC_INSTANCE_ID \
--target-service-instance-id COS_INSTANCE_ID
b) Verify the flow log service account has both Reader AND Writer roles on the COS bucket. Many setups only grant Reader, which allows the service to verify the bucket exists but not write log files.
c) Check bucket policies don’t have explicit deny rules for the flow log service principal.
4. Additional Troubleshooting:
- Verify COS bucket is in the same region as your VPC
- Check that the bucket path in flow log config doesn’t have trailing slashes
- Ensure no network ACLs are blocking the logging service’s internal communication
- Review Cloud Activity Tracker events for any authorization failures
5. Validation:
After fixing IAM permissions, it can take 5-10 minutes for flow logs to start appearing. Monitor the COS bucket for new objects with naming pattern: `{account-id}{vpc-id}{subnet-id}_{timestamp}.gz
The key takeaway: outbound traffic logging failures are almost always IAM-related when ingress works fine. The flow log collector needs full write access to persist both directions of traffic data.