Table: gcp_logging_metric - Query Google Cloud Platform Logging Metrics using SQL
Google Cloud Platform's Logging Metrics is a feature that allows users to create user-defined metrics based on logs. These metrics can be used for monitoring and automating responses to specific log entries. It provides a way to track the count of log entries that match specific filters.
Table Usage Guide
The gcp_logging_metric
table provides insights into user-defined metrics in Google Cloud Platform's Logging. As a system administrator or DevOps engineer, explore metric-specific details through this table, including metric descriptors, metric type, and associated metadata. Utilize it to monitor and automate responses to specific log entries, helping to ensure system stability and performance.
Examples
Filter info of each metric
Explore which logging metrics are currently set up in your Google Cloud Platform (GCP) environment. This can help you understand what kind of data is being collected and monitored, which is critical for effective system management and troubleshooting.
select name as metric_name, description, filterfrom gcp_logging_metric;
select name as metric_name, description, filterfrom gcp_logging_metric;
Bucket configuration details of the logging metrics
Explore the configuration of logging metrics in Google Cloud Platform, focusing on specific parameters such as growth factor, scale, offset, and width. This can be useful in understanding the structure and distribution of data within your logging metrics, aiding in efficient data management and analysis.
select name, exponential_buckets_options_growth_factor, exponential_buckets_options_num_finite_buckets, exponential_buckets_options_scale, linear_buckets_options_num_finite_buckets, linear_buckets_options_offset, linear_buckets_options_width, explicit_buckets_options_boundsfrom gcp_logging_metric;
select name, exponential_buckets_options_growth_factor, exponential_buckets_options_num_finite_buckets, exponential_buckets_options_scale, linear_buckets_options_num_finite_buckets, linear_buckets_options_offset, linear_buckets_options_width, explicit_buckets_options_boundsfrom gcp_logging_metric;
Control examples
- CIS v1.2.0 > 2 Logging and Monitoring > 2.10 Ensure that the log metric filter and alerts exist for Cloud Storage IAM permission changes
- CIS v1.2.0 > 2 Logging and Monitoring > 2.11 Ensure that the log metric filter and alerts exist for SQL instance configuration changes
- CIS v1.2.0 > 2 Logging and Monitoring > 2.4 Ensure log metric filter and alerts exist for project ownership assignments/changes
- CIS v1.2.0 > 2 Logging and Monitoring > 2.5 Ensure that the log metric filter and alerts exist for Audit Configuration changes
- CIS v1.2.0 > 2 Logging and Monitoring > 2.6 Ensure that the log metric filter and alerts exist for Custom Role changes
- CIS v1.2.0 > 2 Logging and Monitoring > 2.7 Ensure that the log metric filter and alerts exist for VPC Network Firewall rule changes
- CIS v1.2.0 > 2 Logging and Monitoring > 2.8 Ensure that the log metric filter and alerts exist for VPC network route changes
- CIS v1.2.0 > 2 Logging and Monitoring > 2.9 Ensure that the log metric filter and alerts exist for VPC network changes
- CIS v1.3.0 > 2 Logging and Monitoring > 2.10 Ensure that the log metric filter and alerts exist for Cloud Storage IAM permission changes
- CIS v1.3.0 > 2 Logging and Monitoring > 2.11 Ensure that the log metric filter and alerts exist for SQL instance configuration changes
- CIS v1.3.0 > 2 Logging and Monitoring > 2.4 Ensure log metric filter and alerts exist for project ownership assignments/changes
- CIS v1.3.0 > 2 Logging and Monitoring > 2.5 Ensure that the log metric filter and alerts exist for Audit Configuration changes
- CIS v1.3.0 > 2 Logging and Monitoring > 2.6 Ensure that the log metric filter and alerts exist for Custom Role changes
- CIS v1.3.0 > 2 Logging and Monitoring > 2.7 Ensure that the log metric filter and alerts exist for VPC Network Firewall rule changes
- CIS v1.3.0 > 2 Logging and Monitoring > 2.8 Ensure that the log metric filter and alerts exist for VPC network route changes
- CIS v1.3.0 > 2 Logging and Monitoring > 2.9 Ensure that the log metric filter and alerts exist for VPC network changes
- CIS v2.0.0 > 2 Logging and Monitoring > 2.10 Ensure that the log metric filter and alerts exist for Cloud Storage IAM permission changes
- CIS v2.0.0 > 2 Logging and Monitoring > 2.11 Ensure that the log metric filter and alerts exist for SQL instance configuration changes
- CIS v2.0.0 > 2 Logging and Monitoring > 2.4 Ensure log metric filter and alerts exist for project ownership assignments/changes
- CIS v2.0.0 > 2 Logging and Monitoring > 2.5 Ensure that the log metric filter and alerts exist for Audit Configuration changes
- CIS v2.0.0 > 2 Logging and Monitoring > 2.6 Ensure that the log metric filter and alerts exist for Custom Role changes
- CIS v2.0.0 > 2 Logging and Monitoring > 2.7 Ensure that the log metric filter and alerts exist for VPC Network Firewall rule changes
- CIS v2.0.0 > 2 Logging and Monitoring > 2.8 Ensure that the log metric filter and alerts exist for VPC network route changes
- CIS v2.0.0 > 2 Logging and Monitoring > 2.9 Ensure that the log metric filter and alerts exist for VPC network changes
- CIS v3.0.0 > 2 Logging and Monitoring > 2.10 Ensure That the Log Metric Filter and Alerts Exist for Cloud Storage IAM Permission Changes
- CIS v3.0.0 > 2 Logging and Monitoring > 2.11 Ensure That the Log Metric Filter and Alerts Exist for SQL Instance Configuration Changes
- CIS v3.0.0 > 2 Logging and Monitoring > 2.4 Ensure Log Metric Filter and Alerts Exist for Project Ownership Assignments/Changes
- CIS v3.0.0 > 2 Logging and Monitoring > 2.5 Ensure That the Log Metric Filter and Alerts Exist for Audit Configuration Changes
- CIS v3.0.0 > 2 Logging and Monitoring > 2.6 Ensure That the Log Metric Filter and Alerts Exist for Custom Role Changes
- CIS v3.0.0 > 2 Logging and Monitoring > 2.7 Ensure That the Log Metric Filter and Alerts Exist for VPC Network Firewall Rule Changes
- CIS v3.0.0 > 2 Logging and Monitoring > 2.8 Ensure That the Log Metric Filter and Alerts Exist for VPC Network Route Changes
- CIS v3.0.0 > 2 Logging and Monitoring > 2.9 Ensure That the Log Metric Filter and Alerts Exist for VPC Network Changes
- Ensure log metric filter and alerts exist for project ownership assignments/changes
- Ensure that the log metric filter and alerts exist for Audit Configuration changes
- Ensure that the log metric filter and alerts exist for Cloud Storage IAM permission changes
- Ensure that the log metric filter and alerts exist for Custom Role changes
- Ensure that the log metric filter and alerts exist for SQL instance configuration changes
- Ensure that the log metric filter and alerts exist for VPC network changes
- Ensure that the log metric filter and alerts exist for VPC Network Firewall rule changes
- Ensure that the log metric filter and alerts exist for VPC network route changes
Schema for gcp_logging_metric
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
create_time | timestamp with time zone | The creation timestamp of the metric. | |
description | text | A user-specified, human-readable description of the metric. | |
explicit_buckets_options_bounds | jsonb | Specifies the bounds, used to create a histogram for the distribution. | |
exponential_buckets_options_growth_factor | double precision | Specifies the growth factor of a bucket with exponential sequence, used to create a histogram for the distribution. Value must be greater than 1. | |
exponential_buckets_options_num_finite_buckets | bigint | Specifies the finite buckets, used to create a histogram for the distribution. Value must be greater than 0. | |
exponential_buckets_options_scale | double precision | Specifies the scale. Value must be greater than 0. | |
filter | text | An advanced logs filter used to match log entries. | |
label_extractors | jsonb | A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. | |
linear_buckets_options_num_finite_buckets | bigint | Specifies the number of finite buckets of linear sequence. Value must be greater than 0. | |
linear_buckets_options_offset | double precision | Specifies the lower bound of the first bucket. | |
linear_buckets_options_width | double precision | Specifies the width, used to create a histogram for the distribution. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
metric_descriptor_display_name | text | A concise name for the metric, which can be displayed in user interfaces. | |
metric_descriptor_labels | jsonb | The set of labels that can be used to instance of this metric type. | |
metric_descriptor_metric_kind | text | The kind of the metric. Possible values are 'METRIC_KIND_UNSPECIFIED', 'GAUGE', 'DELTA', 'CUMULATIVE'. | |
metric_descriptor_type | text | The metric type, including its DNS name in prefix. | |
metric_descriptor_unit | text | The units in which the metric value is reported. | |
metric_descriptor_value_type | text | The value type of the measurement. | |
name | text | = | The client-assigned metric identifier. |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
title | text | Title of the resource. | |
update_time | timestamp with time zone | The last update timestamp of the metric. | |
value_extractor | text | A value_extractor is required when using a distribution logs-based metric to extract the values to record from a log entry. | |
version | text | The API version that created or updated this metric. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- gcp
You can pass the configuration to the command with the --config
argument:
steampipe_export_gcp --config '<your_config>' gcp_logging_metric