A log metric filter and alert should exist for VPC network route changes

이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.

Description

It is recommended that a metric filter and alarm be established for Virtual Private Cloud (VPC) network route changes.

Rationale

Google Cloud Platform (GCP) routes define the paths taken by network traffic from a VM instance to another destination. The other destination can be inside the organization VPC network (such as another VM) or outside of it. Every route consists of a destination and a next hop. Traffic whose destination IP is within the destination range is sent to the next hop for delivery. Monitoring changes to route tables helps to ensure that all VPC traffic flows through an expected path.

Impact

Enabling of logging may result in your project being charged for the additional logs usage.

Remediation

From the console

Create the prescribed Log Metric

  1. Go to Logs-based Metrics within Logging in the Google Cloud console and click CREATE METRIC.
  2. Click the down arrow symbol on the filter bar at the rightmost corner and select Convert to Advanced Filter.
  3. Clear any text and add:
    resource.type="gce_route"
    AND (protoPayload.methodName:"compute.routes.delete"
    OR protoPayload.methodName:"compute.routes.insert")
    
  4. Click Submit Filter. Display logs appear based on the entered filter text.
  5. In the Metric Editor menu on the right, fill out the name field. Set Units to 1 (default) and Type to Counter. This ensures that the log metric counts the number of log entries matching the advanced logs query.
  6. Click Create Metric.

Create the prescribed alert policy

  1. Identify the newly created metric under the section User-defined Metrics in the Logs-based Metrics page in the Google Cloud console.
  2. Click the 3-dot icon in the rightmost column for the new metric and select Create alert from Metric. A new page appears.
  3. Fill out the alert policy configuration and click Save. Choose the alerting threshold and configuration that makes sense for your organization. For example, a threshold of zero(0) for the most recent value ensures that a notification is triggered for every owner change in the project:
    Set `Aggregator` to `Count`
    Set `Configuration`:
    - Condition: above
    - Threshold: 0
    - For: most recent value
    
  4. Configure the desired notification channels in the section Notifications.
  5. Name the policy and click Save.

From the command line

Create the prescribed Log Metric

Use the command gcloud logging metrics create. Read the usage reference in the Google Cloud documentation for more information.

Create the prescribed alert policy

Use the command gcloud alpha monitoring policies create. Read the usage reference in the Google Cloud documentation for more information.

References

  1. https://cloud.google.com/logging/docs/logs-based-metrics/
  2. https://cloud.google.com/monitoring/custom-metrics/
  3. https://cloud.google.com/monitoring/alerts/
  4. https://cloud.google.com/logging/docs/reference/tools/gcloud-logging
  5. https://cloud.google.com/storage/docs/access-control/iam