envoy
envoy copied to clipboard
Unable to parse envoy access log attribute value to int from string using CEL formatter
I’m currently utilizing envoy v1.29.2 and need to perform metric calculations using the x-envoy-upstream-service-time header. However, I’m encountering a challenge where I receive a string value for this header, whereas I require it to be in integer format for my calculations. Therefore, I opted to utilize the CEL formatter to handle type conversion, but I’m facing some difficulties in implementing it. Could you provide assistance or guidance in resolving this issue?
Expression: %CEL(int(response.headers['x-envoy-upstream-service-time']))%
Error: Incorrect configuration: %CEL(int(response.headers['x-envoy-upstream-service-time']))%. Couldn't find valid command at position 0
cc @kyessenov @zirain
I suspect this is because https://github.com/envoyproxy/envoy/blob/7b6b507850ed6a369ba162b53eaba99f5c57c7ca/source/common/formatter/substitution_formatter.cc#L41C54-L41C71 disallows ) in the subcommand of a formatter, causing it to reject function calls in CEL.
Is there a way i can add %REQUEST_TX_DURATION% and %RESPONSE_TX_DURATION% to get envoy latency in access log (json_format)?
I suspect this is because https://github.com/envoyproxy/envoy/blob/7b6b507850ed6a369ba162b53eaba99f5c57c7ca/source/common/formatter/substitution_formatter.cc#L41C54-L41C71 disallows
)in the subcommand of a formatter, causing it to reject function calls in CEL.
Does it mean we cannot convert any string value to int using CEL?
?
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.