Nested quires for cloud insights

0

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?

3 Answers
1

Hello,

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

References:

[1] https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html [2] https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetQueryResults.html

AWS
SUPPORT ENGINEER
answered 2 years ago
0

Hello AWS,

(Sorry, I'm looking for an answer here)

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.

I'm also in a need of using this kind of nested cloudwatch query. Just wondering if you have any planned date for this feature now.

Kind regards,

Pujitha.

answered 10 months ago
0

I think it should be very commonplace to having to be able to group multiple log entries together based on filter criteria. E.g.:

fields @message, @timestamp
| parse @message "[*]" as requestId
| filter requestId in (
    fields @message
    | parse @message "[*]" as requestId
    | filter @message like /E -/
    | stats count() by requestId
    | fields requestId
)
| sort @timestamp desc
| limit 200

Should give me any related lines with that requestId.

Is it really that hart to build something like this?

answered 3 months 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