From ede37fb83978f2608040d2d472b4911ef5cc7ea7 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 20 Mar 2018 18:16:07 -0400 Subject: [PATCH] Remove redundant WFE/WFE2 error logging. (#3579) In some places in the WFE/WFE2 we were calling `logEvent.AddError` and adding a message that was ~= identical to the `detail` of a `ProblemDetails` object returned through the API. For these cases this commit removes the `.AddError` call. We can reference the information from the API level error and this will save us log bytes overall. This commit maintains instances where we call `logEvent.AddError` to add a message with *more* detail than is returned through the API (e.g. including ID #s or internal error strings). --- wfe/wfe.go | 6 ------ wfe2/wfe.go | 2 -- 2 files changed, 8 deletions(-) diff --git a/wfe/wfe.go b/wfe/wfe.go index bb100f037..97f779be1 100644 --- a/wfe/wfe.go +++ b/wfe/wfe.go @@ -729,7 +729,6 @@ func (wfe *WebFrontEndImpl) RevokeCertificate(ctx context.Context, logEvent *web certStatus, err := wfe.SA.GetCertificateStatus(ctx, serial) if err != nil { - logEvent.AddError("unable to get certificate status: %s", err) // TODO(#991): handle db errors wfe.sendError(response, logEvent, probs.NotFound("Certificate status not yet available"), err) return @@ -820,7 +819,6 @@ func (wfe *WebFrontEndImpl) NewCertificate(ctx context.Context, logEvent *web.Re // and encoding/asn1 will refuse to parse it. If this is the case exit early // with a more useful error message. if len(rawCSR.CSR) >= 10 && rawCSR.CSR[8] == 2 && rawCSR.CSR[9] == 0 { - logEvent.AddError("Pre-1.0.2 OpenSSL malformed CSR") wfe.sendError( response, logEvent, @@ -892,7 +890,6 @@ func (wfe *WebFrontEndImpl) NewCertificate(ctx context.Context, logEvent *web.Re response.Header().Set("Content-Type", "application/pkix-cert") response.WriteHeader(http.StatusCreated) if _, err = response.Write(cert.DER); err != nil { - logEvent.AddError(err.Error()) wfe.log.Warning(fmt.Sprintf("Could not write response: %s", err)) } } @@ -1215,7 +1212,6 @@ func (wfe *WebFrontEndImpl) Authorization(ctx context.Context, logEvent *web.Req id := request.URL.Path authz, err := wfe.SA.GetAuthorization(ctx, id) if err != nil { - logEvent.AddError("No such authorization at id %s", id) // TODO(#1199): handle db errors wfe.sendError(response, logEvent, probs.NotFound("Unable to find authorization"), err) return @@ -1295,7 +1291,6 @@ func (wfe *WebFrontEndImpl) Certificate(ctx context.Context, logEvent *web.Reque } response.WriteHeader(http.StatusOK) if _, err = response.Write(cert.DER); err != nil { - logEvent.AddError(err.Error()) wfe.log.Warning(fmt.Sprintf("Could not write response: %s", err)) } return @@ -1313,7 +1308,6 @@ func (wfe *WebFrontEndImpl) Issuer(ctx context.Context, logEvent *web.RequestEve response.Header().Set("Content-Type", "application/pkix-cert") response.WriteHeader(http.StatusOK) if _, err := response.Write(wfe.IssuerCert); err != nil { - logEvent.AddError("unable to write issuer certificate response: %s", err) wfe.log.Warning(fmt.Sprintf("Could not write response: %s", err)) } } diff --git a/wfe2/wfe.go b/wfe2/wfe.go index 158110a0e..90ec36099 100644 --- a/wfe2/wfe.go +++ b/wfe2/wfe.go @@ -1215,7 +1215,6 @@ func (wfe *WebFrontEndImpl) Certificate(ctx context.Context, logEvent *web.Reque response.Header().Set("Content-Type", "application/pem-certificate-chain") response.WriteHeader(http.StatusOK) if _, err = response.Write(responsePEM); err != nil { - logEvent.AddError(err.Error()) wfe.log.Warning(fmt.Sprintf("Could not write response: %s", err)) } return @@ -1227,7 +1226,6 @@ func (wfe *WebFrontEndImpl) Issuer(ctx context.Context, logEvent *web.RequestEve response.Header().Set("Content-Type", "application/pkix-cert") response.WriteHeader(http.StatusOK) if _, err := response.Write(wfe.IssuerCert); err != nil { - logEvent.AddError("unable to write issuer certificate response: %s", err) wfe.log.Warning(fmt.Sprintf("Could not write response: %s", err)) } }