diff --git a/.chloggen/drosiek-syslog-defaults.yaml b/.chloggen/drosiek-syslog-defaults.yaml index 0aeedbe4d321..14c88929a4bc 100755 --- a/.chloggen/drosiek-syslog-defaults.yaml +++ b/.chloggen/drosiek-syslog-defaults.yaml @@ -7,10 +7,10 @@ change_type: bug_fix component: syslogexporter # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: fix default behaviour (disable tls and use proper defaults) +note: use proper defaults according to RFCs # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. -issues: [21245] +issues: [25114] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document. diff --git a/exporter/syslogexporter/config.go b/exporter/syslogexporter/config.go index a81e70bd9242..ea3fbbc75ffd 100644 --- a/exporter/syslogexporter/config.go +++ b/exporter/syslogexporter/config.go @@ -33,7 +33,7 @@ type Config struct { Protocol string `mapstructure:"protocol"` // TLSSetting struct exposes TLS client configuration. - TLSSetting *configtls.TLSClientSetting `mapstructure:"tls"` + TLSSetting configtls.TLSClientSetting `mapstructure:"tls"` exporterhelper.QueueSettings `mapstructure:"sending_queue"` exporterhelper.RetrySettings `mapstructure:"retry_on_failure"` diff --git a/exporter/syslogexporter/exporter.go b/exporter/syslogexporter/exporter.go index 8b6279320433..7d897137f544 100644 --- a/exporter/syslogexporter/exporter.go +++ b/exporter/syslogexporter/exporter.go @@ -26,14 +26,9 @@ type syslogexporter struct { } func initExporter(cfg *Config, createSettings exporter.CreateSettings) (*syslogexporter, error) { - var tlsConfig *tls.Config - var err error - - if cfg.TLSSetting != nil { - tlsConfig, err = cfg.TLSSetting.LoadTLSConfig() - if err != nil { - return nil, err - } + tlsConfig, err := cfg.TLSSetting.LoadTLSConfig() + if err != nil { + return nil, err } cfg.Network = strings.ToLower(cfg.Network) diff --git a/exporter/syslogexporter/exporter_test.go b/exporter/syslogexporter/exporter_test.go index c878e35f831e..58cdb03a61aa 100644 --- a/exporter/syslogexporter/exporter_test.go +++ b/exporter/syslogexporter/exporter_test.go @@ -15,7 +15,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/collector/consumer/consumererror" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/pdata/pcommon" @@ -135,9 +134,7 @@ func prepareExporterTest(t *testing.T, cfg *Config, invalidExporter bool) *expor func createTestConfig() *Config { config := createDefaultConfig().(*Config) config.Network = "tcp" - config.TLSSetting = &configtls.TLSClientSetting{ - Insecure: true, - } + config.TLSSetting.Insecure = true return config }