steampipe plugin install aws

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_value
from
aws_cloudwatch_log_metric_filter;
select
name,
log_group_name,
creation_time,
filter_pattern,
metric_transformation_name,
metric_transformation_namespace,
metric_transformation_value
from
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_pattern
from
aws_cloudwatch_log_metric_filter
where
filter_pattern ilike '%error%';
select
name,
log_group_name,
filter_pattern
from
aws_cloudwatch_log_metric_filter
where
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_count
from
aws_cloudwatch_log_metric_filter
group by
log_group_name;
select
log_group_name,
count(name) as metric_filter_count
from
aws_cloudwatch_log_metric_filter
group by
log_group_name;

Control examples

Schema for aws_cloudwatch_log_metric_filter

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextThe AWS Account ID in which the resource is located.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
creation_timetimestamp with time zoneThe creation time of the metric filter
filter_patterntextA symbolic description of how CloudWatch Logs should interpret the data in each log event
log_group_nametext=The name of the log group
metric_transformation_nametext=The name of the CloudWatch metric
metric_transformation_namespacetext=A custom namespace to contain metric in CloudWatch. Namespaces are used to group together metrics that are similar
metric_transformation_valuetextThe value to publish to the CloudWatch metric when a filter pattern matches a log event
nametext=The name of the metric filter
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
regiontextThe AWS Region in which the resource is located.
titletextTitle 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