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

tcp_proxy: add on-upstream-connected access log flush #26094

Merged
merged 14 commits into from
Mar 16, 2023

Conversation

ohadvano
Copy link
Contributor

@ohadvano ohadvano commented Mar 14, 2023

Commit Message: Add on-upstream-connected access log flush for TCP Proxy.
Additional Description: None
Risk Level: Low
Testing: Unit test, integration tests
Docs Changes: Access logs
Release Notes: None
Platform Specific Features: None

Resolves #26058

Signed-off-by: Ohad Vano <ohadvano@gmail.com>
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @htuch
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #26094 was opened by ohadvano.

see: more, trace.

Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
@ohadvano
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #26094 (comment) was created by @ohadvano.

see: more, trace.

@kyessenov
Copy link
Contributor

CC @htuch for another use case for access logging at the start of the stream.

Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

/lgtm api

@htuch
Copy link
Member

htuch commented Mar 16, 2023

I think this would be needed more generally for HTTP streams, but that can be done in a future PR. @kyessenov what is your take on the API?

@ohadvano
Copy link
Contributor Author

@htuch I thought I should handle this for HTTP case in a separate PR. I'll try get to it in next week but that's on my mind.

@kyessenov
Copy link
Contributor

API looks fine to me. Would be better to share the proto, but not that important.

Copy link
Contributor

@kyessenov kyessenov left a comment

Choose a reason for hiding this comment

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

Mostly LGTM, but I have a few comments.

changelogs/current.yaml Outdated Show resolved Hide resolved
source/common/tcp_proxy/tcp_proxy.h Outdated Show resolved Hide resolved
source/common/tcp_proxy/tcp_proxy.h Outdated Show resolved Hide resolved
setup(1, config);
raiseEventUpstreamConnected(0);

EXPECT_EQ(access_log_data_, "127.0.0.1:80");
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't tell if this is a connection open or closed access log. Is this really the first log line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the fact that it is equal before calling on filter_.reset() makes sure that this was flushed on connection open. Other tests for example are checking this only after calling filter_.reset(). I also tried seeing what happens if I don't call "config.set_flush_access_log_on_connected(true);" and that check did throw.

@kyessenov kyessenov self-assigned this Mar 16, 2023
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
Signed-off-by: Ohad Vano <ohadvano@gmail.com>
@ohadvano ohadvano requested review from htuch and kyessenov and removed request for kyessenov and htuch March 16, 2023 18:47
Copy link
Contributor

@kyessenov kyessenov left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for the quick turn-around.

@kyessenov kyessenov changed the title Add on-upstream-connected access log flush for TCP proxy tcp_proxy: add on-upstream-connected access log flush Mar 16, 2023
@kyessenov kyessenov merged commit fa5f548 into envoyproxy:main Mar 16, 2023
@ohadvano ohadvano deleted the ohadvano/access_log_on_connected branch March 16, 2023 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access log at the beginning of a steam
3 participants