Search code examples
google-cloud-platformstackdrivergoogle-cloud-stackdriver

Google Cloud Stackdriver: Metric grouped by ip


I want to create stackdriver metrics, based on the ip and the frequency of requests an ip makes.

Therefore I would like to group by ip (the IP address of a requesting client) my loadbalancer logs, and if the number of requests exceed a threshold sent a notification.

Edit:

A workaround to achieve this.

  1. Go to Stackdriver Logging and create a User-defined Metric that counts the total requests.
  2. Fire an alarm when requests exceed a threshold.
  3. Alarms call a lambda function that create a sync from stackdriver to bigquery
  4. Execute the queries in order to find out the ip that causes the trouble

Solution

  • There is no out of the box solution so there can be a workaround with BigQuery

    1. Go to Stackdriver Logging and create a User-defined Metric that counts the total requests.
    2. Fire an alarm when requests exceed a threshold.
    3. Alarms call a lambda function that create a sync from stackdriver to bigquery
    4. Execute the queries in order to find out the ip that causes the trouble