{ "message":"Matched route \"some_endpoint_name\", "context":{ "route":"some_endpoint_name", "request_uri":"http://some.domain.com/some/endpoint/91b5602d-f098-471a-aa05-92937fea3636/name", "method":"POST" }, "level":200, "level_name":"INFO", "channel":"request", "datetime":"2024-11-30T10:26:08.594527+00:00", }
As you can see context.request_uri key it's hard to aggregate since each request for the same endpoint will differ due to passed in URI params like UUID of the resource. To avoid mentioned problem we should use rather a context.route value which is declared in Symfony Controller class as one of the value Action Attribute.
Here is example of the CloudWatch Insights query which show in descending order all of the most used POST/PATCH/PUT/DELETE (these are changing state of the system) endpoints in your application:
fields @timestamp, @message, @logStream, @log | filter channel = "request" and context.method != "GET" | stats count(*) as endpointsCallsCount by context.route, context.method | sort endpointsCallsCount desc
The standard output of the query, it's descending order easily shows the most used endpoints in your application |
You can also see results as chart so you can compare all endpoints share in total HTTP traffic volume |
For monitor all GET endpoints worth to filter non functional endpoints call that only checks an availability of the system:
fields @timestamp, @message, @logStream, @log | filter channel = "request" and context.method = "GET" and context.route not in ["health_check","ping"] | stats count(*) as endpointsCallsCount by context.route, context.method | sort endpointsCallsCount desc