Skip to content
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

Query feature not working #88

Closed
maubarrerag opened this issue May 4, 2021 · 5 comments
Closed

Query feature not working #88

maubarrerag opened this issue May 4, 2021 · 5 comments

Comments

@maubarrerag
Copy link

Hi,

Thanks for your effort creating this amazing tool, but i think i found an issue that i don't know how to fix. After fetching the data from AWS i tried to perform a query with the tool but it is not working, here is the log trace:

[3.085ms] [rows:0] CREATE VIEW aws_log_metric_filter_and_alarm AS SELECT * FROM aws_cloudtrail_trails
JOIN aws_cloudtrail_trail_event_selectors on aws_cloudtrail_trails.id = aws_cloudtrail_trail_event_selectors.trail_id
JOIN aws_cloudwatchlogs_metric_filters on aws_cloudtrail_trails.cloud_watch_logs_log_group_name = aws_cloudwatchlogs_metric_filters.log_group_name
JOIN aws_cloudwatch_metric_alarm_metrics on aws_cloudwatchlogs_metric_filters.filter_name = aws_cloudwatch_metric_alarm_metrics.name
JOIN aws_cloudwatch_metric_alarms on aws_cloudwatch_metric_alarm_metrics.metric_alarm_id = aws_cloudwatch_metric_alarms.id
JOIN aws_cloudwatch_metric_alarm_actions ON aws_cloudwatch_metric_alarm_metrics.id = aws_cloudwatch_metric_alarm_actions.metric_alarm_id
JOIN aws_sns_subscriptions ON aws_cloudwatch_metric_alarm_actions.value = aws_sns_subscriptions.topic_arn
WHERE is_multi_region_trail=true AND is_logging=true
AND include_management_events=true AND read_write_type = 'All'
AND subscription_arn LIKE 'aws:arn:%'
Error: ERROR: relation "aws_cloudwatchlogs_metric_filters" does not exist (SQLSTATE 42P01)

That table aws_cloudwatchlogs_metric_filters doesnt exist even in the schemaspy page.

Thanks

@yevgenypats
Copy link
Member

@maubarrerag Thanks for reporting! Can you share the exact command you run with cloudquery? did you run a fetch command or a policy command?

@maubarrerag
Copy link
Author

The problem is with the QUERY command:

./cloudquery query --dsn "host=localhost user=postgres password=admin123 DB.name=postgres port=5432"

Thanks @yevgenypats

@maubarrerag
Copy link
Author

Btw i did build this from code:

./cloudquery --version
cloudquery version development

Maybe thats the problem

@yevgenypats
Copy link
Member

yevgenypats commented May 4, 2021

Got it. Yes it's a bug due to a few changes we introduced lately. we will fix it this week. Thx again for bringing this up!

In the meanwhile you should be able to run SQL statements directly via PostgreSQL - this should work.

@roneli
Copy link
Contributor

roneli commented May 20, 2021

Hello! We Updated CIS policy pack for AWS and AWS provider tables should now work correctly work with all CIS queries. (Requires update to CloudQuery v0.13+ and AWS v0.4.3+ and change config to hcl format). If you need any assistance with the conversion, feel free to ask.

Note the policy command has changed from "query to "policy"

@roneli roneli closed this as completed Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants