diff --git a/lib/proxy/router.go b/lib/proxy/router.go index f54f9718af604..1fc06a5e34754 100644 --- a/lib/proxy/router.go +++ b/lib/proxy/router.go @@ -29,7 +29,6 @@ import ( "github.com/gravitational/trace" "github.com/prometheus/client_golang/prometheus" - "github.com/sirupsen/logrus" "go.opentelemetry.io/otel/attribute" oteltrace "go.opentelemetry.io/otel/trace" "golang.org/x/crypto/ssh" @@ -123,8 +122,6 @@ type LocalAccessPoint interface { type RouterConfig struct { // ClusterName indicates which cluster the router is for ClusterName string - // Log is the logger to use - Log *logrus.Entry // LocalAccessPoint is the proxy cache LocalAccessPoint LocalAccessPoint // SiteGetter allows looking up sites @@ -138,10 +135,6 @@ type RouterConfig struct { // CheckAndSetDefaults ensures the required items were populated func (c *RouterConfig) CheckAndSetDefaults() error { - if c.Log == nil { - c.Log = logrus.WithField(teleport.ComponentKey, "Router") - } - if c.ClusterName == "" { return trace.BadParameter("ClusterName must be provided") } @@ -169,7 +162,6 @@ func (c *RouterConfig) CheckAndSetDefaults() error { // nodes and other clusters. type Router struct { clusterName string - log *logrus.Entry localAccessPoint LocalAccessPoint localSite reversetunnelclient.RemoteSite siteGetter SiteGetter @@ -191,7 +183,6 @@ func NewRouter(cfg RouterConfig) (*Router, error) { return &Router{ clusterName: cfg.ClusterName, - log: cfg.Log, localAccessPoint: cfg.LocalAccessPoint, localSite: localSite, siteGetter: cfg.SiteGetter, diff --git a/lib/proxy/router_test.go b/lib/proxy/router_test.go index 660f9fd435762..6be18370437a2 100644 --- a/lib/proxy/router_test.go +++ b/lib/proxy/router_test.go @@ -609,8 +609,6 @@ type fakeConn struct { func TestRouter_DialHost(t *testing.T) { t.Parallel() - logger := utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test") - srv := &types.ServerV2{ Kind: types.KindNode, Version: types.V2, @@ -668,7 +666,6 @@ func TestRouter_DialHost(t *testing.T) { name: "failure resolving node", router: Router{ clusterName: "test", - log: logger, tracer: tracing.NoopTracer("test"), serverResolver: serverResolver(nil, trace.NotFound(teleport.NodeIsAmbiguous)), }, @@ -682,7 +679,6 @@ func TestRouter_DialHost(t *testing.T) { router: Router{ clusterName: "leaf", siteGetter: tunnel{err: trace.NotFound("unknown cluster")}, - log: logger, tracer: tracing.NoopTracer("test"), }, assertion: func(t *testing.T, params reversetunnelclient.DialParams, conn net.Conn, err error) { @@ -695,7 +691,6 @@ func TestRouter_DialHost(t *testing.T) { name: "dial failure", router: Router{ clusterName: "test", - log: logger, localSite: &testRemoteSite{err: trace.ConnectionProblem(context.DeadlineExceeded, "connection refused")}, tracer: tracing.NoopTracer("test"), serverResolver: serverResolver(srv, nil), @@ -710,7 +705,6 @@ func TestRouter_DialHost(t *testing.T) { name: "dial success", router: Router{ clusterName: "test", - log: logger, localSite: &testRemoteSite{conn: fakeConn{}}, tracer: tracing.NoopTracer("test"), serverResolver: serverResolver(srv, nil), @@ -727,7 +721,6 @@ func TestRouter_DialHost(t *testing.T) { name: "dial success to agentless node", router: Router{ clusterName: "test", - log: logger, localSite: &testRemoteSite{conn: fakeConn{}}, siteGetter: &testSiteGetter{site: &testRemoteSite{conn: fakeConn{}}}, tracer: tracing.NoopTracer("test"), @@ -746,7 +739,6 @@ func TestRouter_DialHost(t *testing.T) { name: "dial success to agentless node using EC2 Instance Connect Endpoint", router: Router{ clusterName: "test", - log: logger, localSite: &testRemoteSite{conn: fakeConn{}}, siteGetter: &testSiteGetter{site: &testRemoteSite{conn: fakeConn{}}}, tracer: tracing.NoopTracer("test"), @@ -783,7 +775,6 @@ func TestRouter_DialSite(t *testing.T) { t.Parallel() const cluster = "test" - logger := utils.NewLoggerForTests().WithField(teleport.ComponentKey, cluster) cases := []struct { name string @@ -863,7 +854,6 @@ func TestRouter_DialSite(t *testing.T) { t.Run(tt.name, func(t *testing.T) { router := Router{ clusterName: cluster, - log: logger, localSite: &tt.localSite, siteGetter: tt.tunnel, tracer: tracing.NoopTracer(cluster), diff --git a/lib/service/service.go b/lib/service/service.go index d57b40779aa9b..fb2b70e19934c 100644 --- a/lib/service/service.go +++ b/lib/service/service.go @@ -4482,7 +4482,6 @@ func (process *TeleportProcess) initProxyEndpoint(conn *Connector) error { if !process.Config.Proxy.DisableReverseTunnel { router, err := proxy.NewRouter(proxy.RouterConfig{ ClusterName: clusterName, - Log: process.log.WithField(teleport.ComponentKey, "router"), LocalAccessPoint: accessPoint, SiteGetter: tsrv, TracerProvider: process.TracingProvider, diff --git a/lib/srv/regular/sshserver_test.go b/lib/srv/regular/sshserver_test.go index 83e8202d9bb74..5b095961c3c68 100644 --- a/lib/srv/regular/sshserver_test.go +++ b/lib/srv/regular/sshserver_test.go @@ -1682,7 +1682,6 @@ func TestProxyRoundRobin(t *testing.T) { router, err := libproxy.NewRouter(libproxy.RouterConfig{ ClusterName: f.testSrv.ClusterName(), - Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"), LocalAccessPoint: proxyClient, SiteGetter: reverseTunnelServer, TracerProvider: tracing.NoopProvider(), @@ -1820,7 +1819,6 @@ func TestProxyDirectAccess(t *testing.T) { router, err := libproxy.NewRouter(libproxy.RouterConfig{ ClusterName: f.testSrv.ClusterName(), - Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"), LocalAccessPoint: proxyClient, SiteGetter: reverseTunnelServer, TracerProvider: tracing.NoopProvider(), @@ -2509,7 +2507,6 @@ func TestParseSubsystemRequest(t *testing.T) { router, err := libproxy.NewRouter(libproxy.RouterConfig{ ClusterName: f.testSrv.ClusterName(), - Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"), LocalAccessPoint: proxyClient, SiteGetter: reverseTunnelServer, TracerProvider: tracing.NoopProvider(), @@ -2768,7 +2765,6 @@ func TestIgnorePuTTYSimpleChannel(t *testing.T) { router, err := libproxy.NewRouter(libproxy.RouterConfig{ ClusterName: f.testSrv.ClusterName(), - Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"), LocalAccessPoint: proxyClient, SiteGetter: reverseTunnelServer, TracerProvider: tracing.NoopProvider(), @@ -3188,7 +3184,6 @@ func TestHostUserCreationProxy(t *testing.T) { router, err := libproxy.NewRouter(libproxy.RouterConfig{ ClusterName: f.testSrv.ClusterName(), - Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"), LocalAccessPoint: proxyClient, SiteGetter: reverseTunnelServer, TracerProvider: tracing.NoopProvider(), diff --git a/lib/web/apiserver_test.go b/lib/web/apiserver_test.go index 27263dafca062..962d52514cad9 100644 --- a/lib/web/apiserver_test.go +++ b/lib/web/apiserver_test.go @@ -424,7 +424,6 @@ func newWebSuiteWithConfig(t *testing.T, cfg webSuiteConfig) *WebSuite { router, err := proxy.NewRouter(proxy.RouterConfig{ ClusterName: s.server.ClusterName(), - Log: utils.NewLoggerForTests().WithField(teleport.ComponentKey, "test"), LocalAccessPoint: s.proxyClient, SiteGetter: revTunServer, TracerProvider: tracing.NoopProvider(), @@ -8219,7 +8218,6 @@ func createProxy(ctx context.Context, t *testing.T, proxyID string, node *regula clustername := authServer.ClusterName() router, err := proxy.NewRouter(proxy.RouterConfig{ ClusterName: clustername, - Log: log.WithField(teleport.ComponentKey, "router"), LocalAccessPoint: client, SiteGetter: revTunServer, TracerProvider: tracing.NoopProvider(),