-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[chore][receiver/windowseventlog] Expose windowseventlogreceiver conf…
…ig on all platforms (#29553) **Description:** Discovered via #29532 (comment). The receiver configuration is not the same between Windows and the other OSes. This is not the practice for other components and make hard to write utilities dealing with the configuration on multiple platforms. The change moves some types to sources that are built for all OSes while preserving the behavior of the receiver. **Link to tracking Issue:** N/A **Testing:** Local Windows and Linux, plus CI on my fork. **Documentation:** N/A
- Loading branch information
Showing
6 changed files
with
104 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package windows // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/input/windows" | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/helper" | ||
) | ||
|
||
const operatorType = "windows_eventlog_input" | ||
|
||
// NewConfig will return an event log config with default values. | ||
func NewConfig() *Config { | ||
return NewConfigWithID(operatorType) | ||
} | ||
|
||
// NewConfig will return an event log config with default values. | ||
func NewConfigWithID(operatorID string) *Config { | ||
return &Config{ | ||
InputConfig: helper.NewInputConfig(operatorID, operatorType), | ||
MaxReads: 100, | ||
StartAt: "end", | ||
PollInterval: 1 * time.Second, | ||
} | ||
} | ||
|
||
// Config is the configuration of a windows event log operator. | ||
type Config struct { | ||
helper.InputConfig `mapstructure:",squash"` | ||
Channel string `mapstructure:"channel"` | ||
MaxReads int `mapstructure:"max_reads,omitempty"` | ||
StartAt string `mapstructure:"start_at,omitempty"` | ||
PollInterval time.Duration `mapstructure:"poll_interval,omitempty"` | ||
Raw bool `mapstructure:"raw,omitempty"` | ||
ExcludeProviders []string `mapstructure:"exclude_providers,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package windowseventlogreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/windowseventlogreceiver" | ||
|
||
import ( | ||
"go.opentelemetry.io/collector/component" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/consumerretry" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/adapter" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator" | ||
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/input/windows" | ||
) | ||
|
||
// createDefaultConfig creates a config with type and version | ||
func createDefaultConfig() component.Config { | ||
return &WindowsLogConfig{ | ||
BaseConfig: adapter.BaseConfig{ | ||
Operators: []operator.Config{}, | ||
RetryOnFailure: consumerretry.NewDefaultConfig(), | ||
}, | ||
InputConfig: *windows.NewConfig(), | ||
} | ||
} | ||
|
||
// WindowsLogConfig defines configuration for the windowseventlog receiver | ||
type WindowsLogConfig struct { | ||
InputConfig windows.Config `mapstructure:",squash"` | ||
adapter.BaseConfig `mapstructure:",squash"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters