- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
09-26-2019 07:24 AM - last edited on 09-02-2020 10:21 AM by kwadsack
Hello all.
New to RQL. I have the below RQL that identifies DEFAULT VPC's;
config where cloud.account IN ( 'AWS_EBU_Networked_Prod_DR_DA_01' ) and api.name = 'aws-ec2-describe-vpcs' AND json.rule = isDefault is true
I have the below RQL that shows all VPC's that do not have FlowLogs enabled;
config where cloud.account IN ( 'AWS_EBU_Networked_Prod_DR_DA_01' ) and api.name = 'aws-ec2-describe-vpcs' as X; config where api.name = 'aws-ec2-describe-flow-logs' as Y; filter ' not ($.Y.resourceId equals $.X.vpcId)'; show X;
Is it possible to combine the 2 so I only show VPC's that do not have FlowLogs enabled AND are not the DEFAULT VPC please?? You help most welcome.
09-27-2019 08:43 AM
Actually I think I have it. I don't understand 'why' this works but it does. Be great if someone could explain the logic for future reference;
config where api.name = 'aws-ec2-describe-vpcs' as X; config where api.name = 'aws-ec2-describe-flow-logs' as Y; filter 'not($.Y.resourceId equals $.X.vpcId) or ($.X.isDefault == true)'; show X;
# appears that is applies the 'not' to both conditions. Also it does not like 'and' but does work with 'or'
09-26-2019 08:06 AM
Hi @MPestell
Quickly adding a filter to your second example, can you confirm if this is doing what you need:
config where api.name = 'aws-ec2-describe-vpcs' as X; config where api.name = 'aws-ec2-describe-flow-logs' as Y; filter '($.X.isDefault is false) and not($.Y.resourceId equals $.X.vpcId)'; show X;
09-27-2019 08:31 AM
Hi and thank you for your reply.
That hasn't exactly worked. What this is bringing back now is indeed those with isDefault=false, however it appears to be ignoring the RQL that looks for VPC's with 'no' Flowlog. Instead it is bringing back just all VPC's that has a isDefault=false.
09-27-2019 08:43 AM
Actually I think I have it. I don't understand 'why' this works but it does. Be great if someone could explain the logic for future reference;
config where api.name = 'aws-ec2-describe-vpcs' as X; config where api.name = 'aws-ec2-describe-flow-logs' as Y; filter 'not($.Y.resourceId equals $.X.vpcId) or ($.X.isDefault == true)'; show X;
# appears that is applies the 'not' to both conditions. Also it does not like 'and' but does work with 'or'
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!