Table: aws_cloudwatch_log_metric_filter - Query AWS CloudWatch log metric filters using SQL
The AWS CloudWatch Log Metric Filter is a feature within AWS CloudWatch that enables you to extract information from the logs and create custom metrics. These custom metrics can be used for detailed monitoring and alarming based on patterns that might appear in your logs. This is a powerful tool for identifying trends, troubleshooting issues, and setting up real-time monitoring across your AWS resources.
Table Usage Guide
The aws_cloudwatch_log_metric_filter
table in Steampipe provides you with information about log metric filters within AWS CloudWatch. This table allows you, as a DevOps engineer, to query filter-specific details, including the associated log group, filter pattern, and metric transformations. You can utilize this table to gather insights on filters, such as filter patterns used, metrics generated from log data, and more. The schema outlines for you the various attributes of the log metric filter, including the filter name, creation date, filter pattern, and associated log group.
Examples
Basic AWS cloudwatch log metric info
Explore the essential characteristics and setup of your AWS CloudWatch log metrics. This query can help you assess the overall configuration and performance metrics of your logs, providing valuable insights for monitoring and optimizing your AWS environment.
select name, log_group_name, creation_time, filter_pattern, metric_transformation_name, metric_transformation_namespace, metric_transformation_valuefrom aws_cloudwatch_log_metric_filter;
select name, log_group_name, creation_time, filter_pattern, metric_transformation_name, metric_transformation_namespace, metric_transformation_valuefrom aws_cloudwatch_log_metric_filter;
List the cloudwatch metric filters that sends error logs to cloudwatch log groups
Identify instances where specific metric filters are configured to send error logs to Cloudwatch log groups. This allows for effective error tracking and proactive issue resolution in cloud environments.
select name, log_group_name, filter_patternfrom aws_cloudwatch_log_metric_filterwhere filter_pattern ilike '%error%';
select name, log_group_name, filter_patternfrom aws_cloudwatch_log_metric_filterwhere filter_pattern like '%error%';
Number of metric filters attached to each cloudwatch log group
Determine the areas in which Cloudwatch log groups have multiple metric filters attached. This can help in managing and optimizing your AWS Cloudwatch setup by understanding the distribution of metric filters across different log groups.
select log_group_name, count(name) as metric_filter_countfrom aws_cloudwatch_log_metric_filtergroup by log_group_name;
select log_group_name, count(name) as metric_filter_countfrom aws_cloudwatch_log_metric_filtergroup by log_group_name;
Schema for aws_cloudwatch_log_metric_filter
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
creation_time | timestamp with time zone | The creation time of the metric filter | |
filter_pattern | text | A symbolic description of how CloudWatch Logs should interpret the data in each log event | |
log_group_name | text | = | The name of the log group |
metric_transformation_name | text | = | The name of the CloudWatch metric |
metric_transformation_namespace | text | = | A custom namespace to contain metric in CloudWatch. Namespaces are used to group together metrics that are similar |
metric_transformation_value | text | The value to publish to the CloudWatch metric when a filter pattern matches a log event | |
name | text | = | The name of the metric filter |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
region | text | The AWS Region 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. |
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)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_cloudwatch_log_metric_filter