gkatzioura
gkatzioura

Reputation: 2820

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

Upvotes: 3

Views: 2154

Answers (2)

gkatzioura
gkatzioura

Reputation: 2820

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

Upvotes: 1

Asif Tanwir
Asif Tanwir

Reputation: 119

  • In Stackdriver Logging, create a User-defined Metric (myMetric) [1] filtered on the desired IP address,
  • In Stackdriver Monitoring, find resource type and metric by locating myMetric to create the chart.

[1] https://cloud.google.com/logging/docs/logs-based-metrics/

Upvotes: 1

Related Questions