contour icon indicating copy to clipboard operation
contour copied to clipboard

How can I convert unit millisecond to seconds in access log

Open vnline opened this issue 2 years ago • 2 comments

I want to customize access log , convert %DURATION% and %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% millisecond unit to seconds unit. Is there anyway to do it ?

json-fields:

  • "request_time=%DURATION%"
  • "upstream_response_time=%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%"

Use seconds unit in access log

vnline avatar Sep 16 '22 09:09 vnline

There are some guidelines on this page for converting an operator like %DURATION% to a different unit: https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#command-operators (see the section about customizing %START_TIME%)

I'm not entirely sure you can do the same with a value grabbed from a request/response header, but worth a try

sunjayBhatia avatar Sep 16 '22 14:09 sunjayBhatia

There are some guidelines on this page for converting an operator like %DURATION% to a different unit: https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#command-operators (see the section about customizing %START_TIME%)

I'm not entirely sure you can do the same with a value grabbed from a request/response header, but worth a try

I try format like below, but report not support.

"request_time=%DURATION(%s.%3f)%"

access log: time="2022-09-17T02:11:16Z" level=error msg="Error adding/updating listener(s) ingress_http: Not supported field in StreamInfo: DURATION(%s.%3f)\n" code=13 connection=134 context=xds node_id=envoy-sc62c node_version=v1.19.1 response_nonce=1 version_info=2

vnline avatar Sep 17 '22 02:09 vnline

The Contour project currently lacks enough contributors to adequately respond to all Issues.

This bot triages Issues according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the Issue is closed

You can:

  • Mark this Issue as fresh by commenting
  • Close this Issue
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

github-actions[bot] avatar Nov 17 '22 00:11 github-actions[bot]

The Contour project currently lacks enough contributors to adequately respond to all Issues.

This bot triages Issues according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the Issue is closed

You can:

  • Mark this Issue as fresh by commenting
  • Close this Issue
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

github-actions[bot] avatar Dec 18 '22 00:12 github-actions[bot]