-
Notifications
You must be signed in to change notification settings - Fork 25
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
Switch to JSON formatted access logs #44
base: master
Are you sure you want to change the base?
Conversation
c81fc70
to
5e28e72
Compare
5e28e72
to
9ee3d3c
Compare
Makefile
Outdated
@@ -70,7 +68,7 @@ ifeq (, $(shell which controller-gen)) | |||
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\ | |||
cd $$CONTROLLER_GEN_TMP_DIR ;\ | |||
go mod init tmp ;\ | |||
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.0 ;\ | |||
go get sigs.k8s.io/controller-tools/cmd/controller-gen@latest ;\ |
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.
Do you think we should pin this to a specific hash?
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.
I've pinned this with this commit b8a2e9c
controllers/configmap.go
Outdated
@@ -35,6 +36,34 @@ import ( | |||
|
|||
// +kubebuilder:rbac:namespace=egress-operator-system,groups=core,resources=configmaps,verbs=get;list;watch;create;patch | |||
|
|||
var ( | |||
logFields = &structpb.Struct{ |
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.
Do these roughly match our service mesh ones?
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.
No, not exactly.
This is what we have for the service mesh
"start_time": "%START_TIME%",
"total_duration_ms": "%DURATION%",
"bytes_received": "%BYTES_RECEIVED%",
"bytes_sent": "%BYTES_SENT%",
"response_flags": "%RESPONSE_FLAGS%",
"destination_host": "%UPSTREAM_HOST%",
"destination_service": "%UPSTREAM_CLUSTER%",
"source_address": "%DOWNSTREAM_REMOTE_ADDRESS%",
"connection_id": "%CONNECTION_ID%",
"connection_termination_details": "%CONNECTION_TERMINATION_DETAILS%",
"requested_sni": "%REQUESTED_SERVER_NAME%",
"hostname": "%HOSTNAME%",
vs what's in this PR:
authority: '%REQ(:AUTHORITY)%'
bytes_received: '%BYTES_RECEIVED%'
bytes_sent: '%BYTES_SENT%'
connection_termination_details: '%CONNECTION_TERMINATION_DETAILS%'
downstream_local_address: '%DOWNSTREAM_LOCAL_ADDRESS%'
downstream_remote_address: '%DOWNSTREAM_REMOTE_ADDRESS%'
duration: '%DURATION%'
method: '%REQ(:METHOD)%'
path: '%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%'
protocol: '%PROTOCOL%'
requested_server_name: '%REQUESTED_SERVER_NAME%'
response_code: '%RESPONSE_CODE%'
response_code_details: '%RESPONSE_CODE_DETAILS%'
response_flags: '%RESPONSE_FLAGS%'
start_time: '%START_TIME%'
upstream_cluster: '%UPSTREAM_CLUSTER%'
upstream_host: '%UPSTREAM_HOST%'
upstream_local_address: '%UPSTREAM_LOCAL_ADDRESS%'
upstream_service_time: '%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%'
upstream_transport_failure_reason: '%UPSTREAM_TRANSPORT_FAILURE_REASON%'
user_agent: '%REQ(USER-AGENT)%'
I'd like to emit access logs in JSON format so as to be able to improve their visibility in our OpenSearch index. In addition to this I made a number of changes:
controller-gen
Example pod logs showing admin logs and cluster access logs (admin logs left as default - but we can move these to JSON to if we want):
JSON access log (prettified):