RQL - display all VPC's, except DEFAULT, that do not have FlowLogs

Announcements
Attention: The LIVEcommunity is experiencing an interruption with videos in some areas. We apologize for any inconvenience this may cause. Thank you for your patience as we work towards a solution to restore videos.
Reply
Highlighted
L2 Linker

RQL - display all VPC's, except DEFAULT, that do not have FlowLogs

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.


Accepted Solutions
Highlighted
L2 Linker

Re: RQL - display all VPC's, except DEFAULT, that do not have FlowLogs

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'

View solution in original post


All Replies
Highlighted
L2 Linker

Re: RQL - display all VPC's, except DEFAULT, that do not have FlowLogs

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;

Highlighted
L2 Linker

Re: RQL - display all VPC's, except DEFAULT, that do not have FlowLogs

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.

 

Highlighted
L2 Linker

Re: RQL - display all VPC's, except DEFAULT, that do not have FlowLogs

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'

View solution in original post

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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 Live Community as a whole!

The Live Community thanks you for your participation!