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

Modify the ACME renewing logs level #2520

Merged
merged 2 commits into from Dec 5, 2017

Conversation

nmengin
Copy link
Contributor

@nmengin nmengin commented Dec 4, 2017

What does this PR do?

This PR transforms the DEBUG logs generated during the ACME certificates renewing into INFO logs in the way to get more information about the process without getting all the others DEBUG logs.

Motivation

Related #2158 and slack support about this subject.

Additional Notes

This PR does not solve the problem but allows getting more information about it.
It seems to be a concurrent access problem.
A test is currently running in the way to repoduce the problem on a long period.

@@ -448,7 +477,7 @@ func dnsOverrideDelay(delay int) error {
return true, nil
}
} else if delay < 0 {
err = fmt.Errorf("Invalid negative DelayDontCheckDNS: %d", delay)
err = fmt.Errorf("invalid negative DelayDontCheckDNS: %d", delay)
Copy link
Contributor

Choose a reason for hiding this comment

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

How come some of these messages start with a capital letter, and others don't?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

@dtomcej dtomcej left a comment

Choose a reason for hiding this comment

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

LGTM
:shipit:

acme/acme.go Outdated
}
log.Infof("Commit Certificate %+v renewed in data store", certificateResource.Domains)
if err = transaction.Commit(account); err != nil {
return fmt.Errorf("error Saving ACME account %+v: %s", account, err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

fmt.Errorf("error Saving ACME account %+v: %v", account, err)

acme/acme.go Outdated

if err = transaction.Commit(account); err != nil {
log.Errorf("Error Saving ACME account %+v: %s", account, err.Error())
log.Errorf("datastore cannot sync: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

could you starts with a upper-case letter.

acme/acme.go Outdated
PrivateKey: certificateResource.Certificate.PrivateKey,
Certificate: certificateResource.Certificate.Certificate,
}, true, OSCPMustStaple)
log.Infof("Renewing certificate %+v from LE", certificateResource.Domains)
Copy link
Member

Choose a reason for hiding this comment

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

log.Infof("Renewing certificate from LE: %+v", certificateResource.Domains)

acme/acme.go Outdated
if err != nil {
log.Errorf("Error renewing certificate: %v", err)
log.Errorf("Error renewing from LE certificate: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

log.Errorf("Error renewing certificate from LE: %v", err)

acme/acme.go Outdated
if err != nil {
return nil, err
}
log.Infof("Renewed certificate %+v from LE", certificateResource.Domains)
Copy link
Member

Choose a reason for hiding this comment

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

log.Infof("Renewed certificate from LE: %+v", certificateResource.Domains)

acme/acme.go Outdated
return fmt.Errorf("Error during transaction initialization for renewing certificate: %v", err)
}
account = object.(*Account)
log.Infof("Renewing certificate %+v in data store", certificateResource.Domains)
Copy link
Member

Choose a reason for hiding this comment

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

log.Infof("Renewing certificate in data store: %+v", certificateResource.Domains)

acme/acme.go Outdated
log.Infof("Renewing certificate %+v in data store", certificateResource.Domains)
err = account.DomainsCertificate.renewCertificates(renewedACMECert, certificateResource.Domains)
if err != nil {
return fmt.Errorf("error renewing certificate: %v in datastore", err)
Copy link
Member

Choose a reason for hiding this comment

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

return fmt.Errorf("error renewing certificate in datastore: %v", err)

acme/acme.go Outdated
oldAccount := a.store.Get().(*Account)
for _, oldCertificateResource := range oldAccount.DomainsCertificate.Certs {
if oldCertificateResource.Domains.Main == certificateResource.Domains.Main && strings.Join(oldCertificateResource.Domains.SANs, ",") == strings.Join(certificateResource.Domains.SANs, ",") && certificateResource.Certificate != renewedACMECert {
return fmt.Errorf("renewed certificate %+v not stored", certificateResource.Domains)
Copy link
Member

Choose a reason for hiding this comment

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

return fmt.Errorf("renewed certificate not stored: %+v", certificateResource.Domains)

acme/acme.go Outdated
return fmt.Errorf("renewed certificate %+v not stored", certificateResource.Domains)
}
}
log.Infof("Certificate %+v successfully renewed in data store", certificateResource.Domains)
Copy link
Member

Choose a reason for hiding this comment

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

log.Infof("Certificate successfully renewed in data store: %+v", certificateResource.Domains)

acme/acme.go Outdated
if err != nil {
return fmt.Errorf("Error during transaction initialization for renewing certificate: %v", err)
}
account = object.(*Account)
Copy link
Member

Choose a reason for hiding this comment

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

Could you add blank lines in this function to aerate the code.

Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

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

LGTM

@traefiker traefiker force-pushed the feature/add-logs-during-acme-renew branch from b6095de to 0681fe5 Compare December 5, 2017 14:28
@traefiker traefiker merged commit 6333bfe into traefik:v1.5 Dec 5, 2017
@nmengin nmengin deleted the feature/add-logs-during-acme-renew branch August 3, 2018 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants