Read path parameters from requesturi to enable endpoint level aggregated metrics

Hi, I'm using AWS-ElasticSearch+kibana to save apigee logs and create metrics on the logged data. While creating the api's endpoint level metrics I'm seeing problem with requests involving the path parameters(I took care of query parameters). Example - Though the endpoints- shops/shop1/orders/order123 and shops/shop2/orders/order232 uses the same endpoint, there is noway i can create aggregated metrics at endpoint level unless I can read path parameters and make the path for two endpoints in the above example as something like this shops/COMMOMSHOP/orders/COMMONORDER in my log (I'm not worried about missing the real value of the path parameter in log as I can save the real data in different variable instead I would like to get the traffic/other metrics on the specific endpoint). This logic is part of the sharedflow that is common to all my proxies. So, it would be great if there are no changes at the proxy level instead on the sharedflow. Below if the flow I have -

ProxyA --> Logging Shared Flow --> AWS Elasticsearch --> Kibana

Any thoughts on this is appreciated.

0 3 501
3 REPLIES 3

@Anil sagar@google

Hi Krishna,
I expect your endpoint like `/shops/{shopId}/orders/{orderId}` should be defined as a Flow in either the proxy or target definition, so then what I'd do is log apigee variable "current.flow.name" with each request. Then all requests to the same "flow" will have that value in your log message and you could show aggregated metrics on the flow name.

Since you are creating the logging message and doing the logging in a Shared Flow, you could merely adjust the URL to use whatever path your want, in your case replacing identifier values with constants.

It's not possible to mask the URL segments in analytics, that would be nice as others have asked.

However, you could create a custom analytics variable and use that in analytics. For example, create a variable "masked_uri" and set the value in the shared flow to the masked value "/shops/SHOP/orders/ORDER", then populate analytics using the Statistics Collector. Finally create a report based off that custom dimension.

10267-screen-shot-2020-09-01-at-120154-pm.png

And if you also add proxy path suffix as a dimension, you can drill down on the masked URI.

10266-screen-shot-2020-09-01-at-115925-am.png