2

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?

1 Answer 1

0

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)
Sign up to request clarification or add additional context in comments.

4 Comments

Yeah that I get. But the time durations like @initDuration is part of another message and not part of console.log message.
Got it, let me know if the corrected version of the answer solves your problem.
Hi, actually no it will not work. For a single request my log trail looks like : START requestID1 xxxx INFO requestID1 CustomMessage END requestID1 xxxxx REPORT requestID1 xxxxx And then another log trail let's say : START requestID2 xxxx INFO requestID2 randomMessage END requestID2 xxxxx REPORT requestID2 xxxxx Your answer will still give me durations from reports of requestID1 which have this CustomMessage in @message.
Why is this message random?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.