-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_cloudwatch_log_group key column is not globally unique #1975
Comments
@bryanburke, I'm sorry to hear that you're experiencing issues.
We will take a look at the issue. Thanks! |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Describe the bug
The key column for the aws_cloudwatch_log_group table is
name
: https://github.com/turbot/steampipe-plugin-aws/blob/v0.123.0/aws/table_aws_cloudwatch_log_group.go#L23However, Amazon CloudWatch Logs log group names are only unique within a specific AWS account and region. Thus, queries that filter on exact log group name fail when the same log group name exists in multiple account-region pairs.
I believe the solution is to make the globally unique resource ARN the key column for the table.
Other CloudWatch Logs resource tables may be affected as well, though I have not tested them. For example: https://github.com/turbot/steampipe-plugin-aws/blob/v0.123.0/aws/table_aws_cloudwatch_log_stream.go#L29
Steampipe version (
steampipe -v
)v0.21.0
Plugin version (
steampipe plugin list
)v0.123.0
To reproduce
Create a CloudWatch Logs log group named "steampipe-test" in us-east-1.
Create another log group named "steampipe-test" in us-east-2 in the same AWS account.
Query log groups across both regions with a filter on that exact name:
steampipe query "SELECT account_id, region, name FROM aws_cloudwatch_log_group WHERE name = 'steampipe-test' ORDER BY account_id ASC, region ASC;"
Observe the following error:
Error: get call returned 2 results - the key column is not globally unique (SQLSTATE HV000)
Expected behavior
The query above no longer results in an error.
Additional context
Until this issue is fixed, using
LIKE
instead of exact equality seems to be a workaround:steampipe query "SELECT account_id, region, name FROM aws_cloudwatch_log_group WHERE name LIKE 'steampipe-test' ORDER BY account_id ASC, region ASC;"
However, in terms of execution plan, I imagine
LIKE
is less efficient than exact string matching.Thanks for all your hard work making and supporting this wonderful tool!
The text was updated successfully, but these errors were encountered: