-
Notifications
You must be signed in to change notification settings - Fork 672
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
Add support for custom Envoy JSON fields #3059
Add support for custom Envoy JSON fields #3059
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3059 +/- ##
==========================================
- Coverage 73.22% 73.21% -0.01%
==========================================
Files 95 95
Lines 6057 6056 -1
==========================================
- Hits 4435 4434 -1
Misses 1521 1521
Partials 101 101
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mike1808,
Overally, I think this looks pretty good.
-
We should document this in
./site/_site/docs/main/configuration.md
. It's
OK to do this in a separate PR if you prefer. -
I think that it would be clearer to split the validation regex to handle the
simple case (e.g.%HOSTNAME%
) and complex case (e.g.%REQ(foo?bar):baz%
)
separately. This would make the regex much more obvious and the code easier to
follow. TheREQ/RESP
regex only needs to validate the capture from the simple
case (i.e.REQ(foo?bar):baz
) -
Once you do (2), there's an opportunity to have a single definition of the
simple expressions. If you defineEnvoyOperators
to just be the simple
operators, then you can derive the JSON field name from that, and add those
mappings toJSONFields
in aninit
function. TheEnvoyOperators
map should
go intopkg/config/accesslog.go
.
|
c007f5c
to
19a8fbb
Compare
@jpeach we updated the PR and tried to address all review comments. One thing we're not sure about is our approach for keeping parsed access log fields in the |
4261478
to
2cadfa7
Compare
@jpeach we renamed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice work. I'm looking forward to seeing the docs update as well, I think that's key for making this feature more usable. We should wait for @jpeach to approve as well though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mike1808, this looks great. Could you just take care of the couple of nits, then we can merge.
Add support for custon Envoy JSON fields via use of `=` in the field name. See [design doc](design/envoy-json-logging-custom-fields-design.md) for more information. Fixes projectcontour#3032, projectcontour#1507 Signed-off-by: Mikael Manukyan <mmanukyan@vmware.com> Co-authored-by: Clay Kauzlaric <ckauzlaric@vmware.com> Co-authored-by: Alexander Standke <astandke@vmware.com>
2cadfa7
to
190c669
Compare
Latest comments addressed and fixed up into the commit, rebased against |
follow-up for projectcontour#3059 Co-authored-by: Leah Hanson <lhanson@pivotal.io>
follow-up for projectcontour#3059 Co-authored-by: Leah Hanson <lhanson@pivotal.io> Co-authored-by: Alex Standke <astandke@vmware.com>
follow-up for #3059 Co-authored-by: Leah Hanson <lhanson@pivotal.io> Co-authored-by: Alex Standke <astandke@vmware.com>
* We'll use "main" branch release until [our access log changes](projectcontour/contour#3059) make into an actual version [#175505884](https://www.pivotaltracker.com/story/show/175505884) Co-authored-by: Clay Kauzlaric <ckauzlaric@vmware.com>
* We'll use "main" branch release until [our access log changes](projectcontour/contour#3059) make into an actual version [#175505884](https://www.pivotaltracker.com/story/show/175505884) Co-authored-by: Clay Kauzlaric <ckauzlaric@vmware.com>
* We'll use "main" branch release until [our access log changes](projectcontour/contour#3059) make into an actual version [#175505884](https://www.pivotaltracker.com/story/show/175505884) Co-authored-by: Clay Kauzlaric <ckauzlaric@vmware.com>
Add support for custom Envoy JSON fields via
=
in the fields name. The specify custom field name and its Envoy format string use=
in the field name. The syntax is the following:field_name=Envoy format string
, where Envoy format string can have any command exceptDYNAMIC_METADATA
andFILTER_STATE
commands.Example of custom field:
Fixes #3032, Fixes #1507
cc @KauzClay