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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

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

L2 Linker

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.

1 accepted solution

Accepted Solutions

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

3 REPLIES 3

L2 Linker

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;

L2 Linker

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.

 

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'

  • 1 accepted solution
  • 7518 Views
  • 3 replies
  • 0 Likes
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 LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!