简体   繁体   中英

Using nested query in AWS log insights

I am using AWS Lambdas to host some services. To mitigate issue of cold start, I'm using serverless plugin warmup .

Now using cloudwatch log insights, I intend to figure out p99/p95 of all the requests going to my lambda but exclude requests made by the plugin. For this one query which should help is , figure out requestIDs for plugin calls ( I'm logging a certain message based on which I can filter out those requests ). Now I want all those requests whose request IDS are not in these requests IDs. In sql this would transform to a nested query.

Rough version :

SELECT @duration from requestIDs where requestID not in ( SELECT RequestID where @message like ***** )

Do we have a way in which I can do such query in Log Insights?

Yes, you can remove messages from the warmup plugin by piping all messages to the filter with not like condition and then to pct(fieldName: LogFieldValue, percent: number) function:

fields @duration
| filter @message not like "MESSAGE TO EXCLUDE"
| stats pct(@duration, 99)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM