Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-audit-logger-startup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#bugfix #nops Fix node startup when the audit logger is enabled by assigning the service a health-check name.
3 changes: 2 additions & 1 deletion core/logger/audit/audit_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
)

const (
auditLoggerName = "AuditLogger"
bufferCapacity = 2048
webRequestTimeout = 10
)
Expand Down Expand Up @@ -91,7 +92,7 @@ func NewAuditLogger(logger logger.Logger, config config.AuditLogger) (AuditLogge

// Create new AuditLoggerService
auditLogger := AuditLoggerService{
logger: logger.Helper(1),
logger: logger.Named(auditLoggerName).Helper(1),
enabled: true,
forwardToUrl: forwardToUrl,
headers: headers,
Expand Down
14 changes: 13 additions & 1 deletion core/logger/audit/audit_logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/urfave/cli"

commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config"
commonservices "github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/logger/audit"
Expand Down Expand Up @@ -81,6 +82,17 @@ func (c Config) JsonWrapperKey() string {
return ""
}

func TestAuditLoggerRegistersForHealthChecks(t *testing.T) {
t.Parallel()

auditLogger, err := audit.NewAuditLogger(logger.TestLogger(t), Config{})
require.NoError(t, err)
require.Equal(t, "AuditLogger", auditLogger.Name())

healthChecker := commonservices.HealthCheckerConfig{}.New()
require.NoError(t, healthChecker.Register(auditLogger))
}

func TestCheckLoginAuditLog(t *testing.T) {
t.Parallel()

Expand All @@ -99,7 +111,7 @@ func TestCheckLoginAuditLog(t *testing.T) {
auditLoggerTestConfig := Config{}

// Create new AuditLoggerService
auditLogger, err := audit.NewAuditLogger(logger.Named("AuditLogger"), &auditLoggerTestConfig)
auditLogger, err := audit.NewAuditLogger(logger, &auditLoggerTestConfig)
assert.NoError(t, err)

// Cast to concrete type so we can swap out the internals
Expand Down