-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Enable access log for default backend #3780
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -98,4 +98,35 @@ var _ = framework.IngressNginxDescribe("Default backend", func() { | |||
Expect(resp.StatusCode).Should(Equal(test.Status)) | ||||
} | ||||
}) | ||||
It("enables access logging for default backend", func() { | ||||
f.UpdateNginxConfigMapData("enable-access-log-for-default-backend", "true") | ||||
host := "foo" | ||||
resp, _, errs := gorequest.New(). | ||||
Get(f.GetURL(framework.HTTP)+"/somethingOne"). | ||||
Set("Host", host). | ||||
End() | ||||
|
||||
Expect(len(errs)).Should(Equal(0)) | ||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound)) | ||||
|
||||
logs, err := f.NginxLogs() | ||||
Expect(err).ToNot(HaveOccurred()) | ||||
Expect(logs).To(ContainSubstring("/somethingOne")) | ||||
}) | ||||
|
||||
It("disables access logging for default backend", func() { | ||||
f.UpdateNginxConfigMapData("enable-access-log-for-default-backend", "false") | ||||
host := "bar" | ||||
resp, _, errs := gorequest.New(). | ||||
Get(f.GetURL(framework.HTTP)+"/somethingTwo"). | ||||
Set("Host", host). | ||||
End() | ||||
|
||||
Expect(len(errs)).Should(Equal(0)) | ||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound)) | ||||
|
||||
logs, err := f.NginxLogs() | ||||
Expect(err).ToNot(HaveOccurred()) | ||||
Expect(logs).ToNot(ContainSubstring("/somethingTwo")) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This i replace this same There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this line printed? can you help me? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @arturxx8 I think this is coming from the "upstream server":
I'm okay to solve this by adding |
||||
}) | ||||
}) |
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.
@ElvinEfendi I replace `"/somethingOne"` to "/somethingOne" because compare string looks like this:
10.244.2.1 - [10.244.2.1] - - [25/Feb/2019:21:04:21 +0000] "GET /somethingOne HTTP/1.1" 404 153 "-" "Go-http-client/1.1" 147 0.000 [upstream-default-backend] 127.0.0.1:8181 153 0.000 404 b7b4ad156e96a41d5543528f3bdc2ca6