From dbd793701ef56c59bd7bc47d33fb10a62cb6724f Mon Sep 17 00:00:00 2001 From: ldebruijn Date: Tue, 4 Jun 2024 11:32:33 +0200 Subject: [PATCH] feat(access-logging): Remove otel logging --- docs/protections/access_logging.md | 1 + go.mod | 2 -- go.sum | 4 ---- internal/business/protect/protect.go | 2 +- internal/business/rules/accesslogging/accesslogging.go | 6 ++---- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/docs/protections/access_logging.md b/docs/protections/access_logging.md index 9ef7abb..9f8fcfa 100644 --- a/docs/protections/access_logging.md +++ b/docs/protections/access_logging.md @@ -1,6 +1,7 @@ # Access Logging In some cases you want to keep a record of what operations were performed against your landscape. The access logging protection can provide that for you. +Access logging is done to STDOUT. diff --git a/go.mod b/go.mod index 54aa1e4..bc704fe 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/prometheus/client_golang v1.19.1 github.com/stretchr/testify v1.9.0 github.com/vektah/gqlparser/v2 v2.5.12 - go.opentelemetry.io/contrib/bridges/otelslog v0.2.0 go.opentelemetry.io/contrib/exporters/autoexport v0.52.0 go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.52.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 @@ -62,7 +61,6 @@ require ( go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 // indirect - go.opentelemetry.io/otel/log v0.3.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect go.opentelemetry.io/otel/trace v1.27.0 // indirect diff --git a/go.sum b/go.sum index e9f16f1..3d33515 100644 --- a/go.sum +++ b/go.sum @@ -129,8 +129,6 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/collector/pdata v1.7.0 h1:/WNsBbE6KM3TTPUb9v/5B7IDqnDkgf8GyFhVJJqu7II= go.opentelemetry.io/collector/pdata v1.7.0/go.mod h1:ehCBBA5GoFrMZkwyZAKGY/lAVSgZf6rzUt3p9mddmPU= -go.opentelemetry.io/contrib/bridges/otelslog v0.2.0 h1:8wisJ9dZUU1YZGJDsQgfCkexQ/zsZF1SZB6Z86j4WJA= -go.opentelemetry.io/contrib/bridges/otelslog v0.2.0/go.mod h1:/fUobpnNkWPrkMb7HKL80Ewfkqzyko1KUUX0h7aNtxo= go.opentelemetry.io/contrib/bridges/prometheus v0.52.0 h1:NNkEjNcUXeNcxDTNLyyAmFHefByhj8YU1AojgcPqbfs= go.opentelemetry.io/contrib/bridges/prometheus v0.52.0/go.mod h1:Dv7d2yUvusfblvi9qMQby+youF09GiUVWRWkdogrDtE= go.opentelemetry.io/contrib/exporters/autoexport v0.52.0 h1:G/AGl5O78ZKHs63Rl65P1HyZfDnTyxjv8r7dbdZ9fB0= @@ -169,8 +167,6 @@ go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 h1:/jlt1Y8gXWiHG9 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0/go.mod h1:bmToOGOBZ4hA9ghphIc1PAf66VA8KOtsuy3+ScStG20= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 h1:/0YaXu3755A/cFbtXp+21lkXgI0QE5avTWA2HjU9/WE= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0/go.mod h1:m7SFxp0/7IxmJPLIY3JhOcU9CoFzDaCPL6xxQIxhA+o= -go.opentelemetry.io/otel/log v0.3.0 h1:kJRFkpUFYtny37NQzL386WbznUByZx186DpEMKhEGZs= -go.opentelemetry.io/otel/log v0.3.0/go.mod h1:ziCwqZr9soYDwGNbIL+6kAvQC+ANvjgG367HVcyR/ys= go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= diff --git a/internal/business/protect/protect.go b/internal/business/protect/protect.go index e89cc92..813e830 100644 --- a/internal/business/protect/protect.go +++ b/internal/business/protect/protect.go @@ -44,7 +44,7 @@ func NewGraphQLProtect(log *slog.Logger, cfg *config.Config, po *persistedoperat aliases.NewMaxAliasesRule(cfg.MaxAliases) max_depth.NewMaxDepthRule(cfg.MaxDepth) maxBatch, err := batch.NewMaxBatch(cfg.MaxBatch) - accessLogging := accesslogging.NewAccessLogging(cfg.AccessLogging) + accessLogging := accesslogging.NewAccessLogging(cfg.AccessLogging, log) if err != nil { log.Warn("Error initializing maximum batch protection", err) } diff --git a/internal/business/rules/accesslogging/accesslogging.go b/internal/business/rules/accesslogging/accesslogging.go index 48f24b7..335dc6f 100644 --- a/internal/business/rules/accesslogging/accesslogging.go +++ b/internal/business/rules/accesslogging/accesslogging.go @@ -2,7 +2,6 @@ package accesslogging import ( "github.com/ldebruijn/graphql-protect/internal/business/gql" - "go.opentelemetry.io/contrib/bridges/otelslog" "log/slog" "net/http" "slices" @@ -21,10 +20,9 @@ type AccessLogging struct { cfg Config } -func NewAccessLogging(cfg Config) *AccessLogging { +func NewAccessLogging(cfg Config, log *slog.Logger) *AccessLogging { return &AccessLogging{ - // otelslog bridge for pushing otellogs directly to connector - log: otelslog.NewLogger("access-logging"), + log: log.WithGroup("access-logging"), cfg: cfg, } }