Skip to content

Commit

Permalink
[receiver/splunkhec] splunkhecreiver adopts ``component.UseLocalHostA…
Browse files Browse the repository at this point in the history
…sDefaultHost` feature gate` (#30847)

**Description:**
Add `component.UseLocalHostAsDefaultHost` feature gate that changes
default endpoints from 0.0.0.0 to localhost

**Link to tracking Issue:**
#30702

**Documentation:**
Updated docs.

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
  • Loading branch information
atoulme and mx-psi committed Jan 31, 2024
1 parent cf09bb6 commit 5943dac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .chloggen/mx-psi_internal-localhostgate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ subtext: |
- receiver/zipkin
- receiver/awsfirehose
- processor/remotetap
- receiver/splunk_hec
# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
Expand Down
2 changes: 2 additions & 0 deletions receiver/splunkhecreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The following settings are required:
* `endpoint` (default = `0.0.0.0:8088`): Address and port that the Splunk HEC
receiver should bind to.

The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:8088. This will become the default in a future release.

The following settings are optional:

* `access_token_passthrough` (default = `false`): Whether to preserve incoming
Expand Down
2 changes: 1 addition & 1 deletion receiver/splunkhecreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "tls"),
expected: &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: ":8088",
Endpoint: "0.0.0.0:8088",
TLSSetting: &configtls.TLSServerSetting{
TLSSetting: configtls.TLSSetting{
CertFile: "/test.crt",
Expand Down
5 changes: 3 additions & 2 deletions receiver/splunkhecreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"go.opentelemetry.io/collector/receiver"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/localhostgate"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver/internal/metadata"
Expand All @@ -21,7 +22,7 @@ import (

const (
// Default endpoints to bind to.
defaultEndpoint = ":8088"
defaultPort = 8088
)

// NewFactory creates a factory for Splunk HEC receiver.
Expand All @@ -37,7 +38,7 @@ func NewFactory() receiver.Factory {
func createDefaultConfig() component.Config {
return &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: defaultEndpoint,
Endpoint: localhostgate.EndpointForPort(defaultPort),
},
AccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{},
HecToOtelAttrs: splunk.HecToOtelAttrs{
Expand Down

0 comments on commit 5943dac

Please sign in to comment.