Nested quires for cloud insights


I have two queries to run aws lambda cloud watch logs. The first query returns me the requestId of lambdas based on the condition used. fields @requestId |filter objectType=“filter-keyword" I want to use the requestId's returned by the above query to check lambda average duration for those request id's only.

filter @type = "REPORT" | stats avg(@duration), max(@duration), min(@duration) by bin(5m)

Is it possible to achieve this in same query? does cloud watch insight query support nested queries?

1 Answer


I would like to mention that currently Logs Insights query does not support nested queries.

We already have an internal feature request for the same and I have gone ahead and associated this query to it in order to further escalate this feature. However please note that I cannot provide you with an ETA as to when this will be available.

As a possible workaround you can achieve this by programmatically running insights queries using StartQuery/GetQueryResults APIs[1][2] via custom code/script.

I hope you find the above information useful.

Stay safe and have a nice day


[1] [2]

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions