Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(accesslog): support config omit_empty_values #2403

Closed
wants to merge 1 commit into from

Conversation

j2gg0s
Copy link

@j2gg0s j2gg0s commented Jun 30, 2022

Support user config omit_empty_values for Envoy's AccessLog, reference Issue/31060.

Related envoy's SubstitutionFormatString.omit_empty_values

@istio-policy-bot
Copy link

😊 Welcome @j2gg0s! This is either your first contribution to the Istio api repo, or it's been
awhile since you've been here.

You can learn more about the Istio working groups, code of conduct, and contributing guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@istio-testing istio-testing added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test labels Jun 30, 2022
@istio-testing
Copy link
Collaborator

Hi @j2gg0s. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@j2gg0s j2gg0s force-pushed the feat-accesslog-omit-empty branch from 3f254ab to bc1151d Compare June 30, 2022 08:28
@istio-testing istio-testing added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 30, 2022
@zirain
Copy link
Member

zirain commented Jun 30, 2022

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Jun 30, 2022
@istio-testing istio-testing added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 30, 2022
@j2gg0s
Copy link
Author

j2gg0s commented Jun 30, 2022

@j2gg0s: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
release-notes_api 71e0d4d link false /test release-notes_api

this pr need release notes?

mesh/v1alpha1/config.proto Show resolved Hide resolved
mesh/v1alpha1/config.proto Outdated Show resolved Hide resolved
mesh/v1alpha1/config.proto Show resolved Hide resolved
@j2gg0s j2gg0s force-pushed the feat-accesslog-omit-empty branch from 71e0d4d to 988c0a5 Compare June 30, 2022 10:54
@zirain zirain added the release-notes-none Indicates a PR that does not require release notes. label Jun 30, 2022
@zirain
Copy link
Member

zirain commented Jun 30, 2022

/test release-notes_api

@j2gg0s j2gg0s force-pushed the feat-accesslog-omit-empty branch from 988c0a5 to bfcd47a Compare July 1, 2022 01:53
@istio-testing istio-testing added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 1, 2022
@j2gg0s j2gg0s force-pushed the feat-accesslog-omit-empty branch 2 times, most recently from 9d7900a to 086b9af Compare July 1, 2022 01:58
@j2gg0s j2gg0s force-pushed the feat-accesslog-omit-empty branch 2 times, most recently from 995b3f2 to 9f12db9 Compare July 4, 2022 02:19
@istio-testing istio-testing added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 4, 2022
@j2gg0s
Copy link
Author

j2gg0s commented Jul 4, 2022

Any other thing than i need to fix?

@linsun
Copy link
Member

linsun commented Jul 6, 2022

Yes, can we add a release note for this pls?

@linsun linsun removed the release-notes-none Indicates a PR that does not require release notes. label Jul 6, 2022
// for labels, the keys with null values are omitted in the output structure.
//
// Example: `omit_empty_values: true`
bool omit_empty_values = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we explain why this is useful and give 1 or two examples? I had to lookup the original issue and envoy docs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • omit_empty_values is atrribute of envoy's log format, istio should allow this feature to be use by anyone who need.
  • As an example, we need log CONNECTION_TERMINATION_DETAILS only when connection be terminated,storing this field with null is waste.
  • log with null is ugly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@j2gg0s maybe the action here is to link to the envoy docs directly as a "for more information" style helper?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@douglas-reid Did i understand correctly? With latest note

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable to me. @linsun wdyt ?

@j2gg0s j2gg0s force-pushed the feat-accesslog-omit-empty branch from 9f12db9 to 3778328 Compare July 14, 2022 02:53
@istio-testing istio-testing added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 14, 2022
@istio-testing
Copy link
Collaborator

@j2gg0s: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
release-notes_api 3778328 link false /test release-notes_api

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@zirain
Copy link
Member

zirain commented Jul 23, 2022

kindly ping @linsun

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Aug 11, 2022
@istio-testing
Copy link
Collaborator

@j2gg0s: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@akashjain971
Copy link

Anyone taking this forward?

@j2gg0s
Copy link
Author

j2gg0s commented Nov 30, 2023

Anyone taking this forward?

@akashjain971 I switched to EnvoyFilters to manage logs, such as:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: log
  namespace: istio-system
spec:
  configPatches:
  - applyTo: NETWORK_FILTER
    match:
      listener:
        filterChain:
          filter:
            name: envoy.filters.network.http_connection_manager
    patch:
      operation: MERGE
      value:
        typed_config:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          accessLog:
          - name: envoy.access_loggers.file
            typedConfig:
              '@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
              logFormat:
                jsonFormat:
                  authority: '%REQ(:AUTHORITY)%'
                  ...
                  upstream_transport_failure_reason: '%UPSTREAM_TRANSPORT_FAILURE_REASON%'
                omit_empty_values: true
              path: /dev/stdout

@akashjain971
Copy link

akashjain971 commented Nov 30, 2023

Anyone taking this forward?

@akashjain971 I switched to EnvoyFilters to manage logs, such as:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: log
  namespace: istio-system
spec:
  configPatches:
  - applyTo: NETWORK_FILTER
    match:
      listener:
        filterChain:
          filter:
            name: envoy.filters.network.http_connection_manager
    patch:
      operation: MERGE
      value:
        typed_config:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          accessLog:
          - name: envoy.access_loggers.file
            typedConfig:
              '@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
              logFormat:
                jsonFormat:
                  authority: '%REQ(:AUTHORITY)%'
                  ...
                  upstream_transport_failure_reason: '%UPSTREAM_TRANSPORT_FAILURE_REASON%'
                omit_empty_values: true
              path: /dev/stdout

Thank you @j2gg0s. This should sail my boat for now but will this not add latency for every request?

@akashjain971
Copy link

akashjain971 commented Dec 1, 2023

Looks like OmitEmptyValues is already supported here.
This required Istio code changes and cannot be done from the IstioOperator.

@howardjohn howardjohn removed the needs-rebase Indicates a PR needs to be rebased before being merged label May 15, 2024
@istio-policy-bot
Copy link

🚧 This issue or pull request has been closed due to not having had activity from an Istio team member since 2022-07-23. If you feel this issue or pull request deserves attention, please reopen the issue. Please see this wiki page for more information. Thank you for your contributions.

Created by the issue and PR lifecycle manager.

@istio-policy-bot istio-policy-bot added the lifecycle/automatically-closed Indicates a PR or issue that has been closed automatically. label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/automatically-closed Indicates a PR or issue that has been closed automatically. ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants