Skip to content

Commit

Permalink
Use consts for backend config
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwolf committed Jan 30, 2024
1 parent 9c59a7b commit 0691b06
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ func New(cfg *config.C) (beat.Processor, error) {
logger.Debugf("backfilled %d processes", len(backfilledPIDs))

switch c.Backend {
case "auto":
case BackendAuto:
// "auto" always uses ebpf, as it's currently the only backend
fallthrough
case "ebpf":
case BackendEbpf:
p, err := ebpf_provider.NewProvider(ctx, logger, db)
if err != nil {
return nil, fmt.Errorf("failed to create ebpf provider: %w", err)
Expand Down

This file was deleted.

17 changes: 11 additions & 6 deletions x-pack/auditbeat/processors/add_session_metadata/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

//go:build linux

package add_session_metadata

type Backend string

const (
BackendAuto Backend = "auto"
BackendEbpf Backend = "ebpf"
)

// Config for add_session_metadata processor.
type Config struct {
Backend string `config:"backend"`
ReplaceFields bool `config:"replace_fields"`
PidField string `config:"pid_field"`
Backend Backend `config:"backend"`
ReplaceFields bool `config:"replace_fields"`
PidField string `config:"pid_field"`
}

func defaultConfig() Config {

Check failure on line 21 in x-pack/auditbeat/processors/add_session_metadata/config.go

View workflow job for this annotation

GitHub Actions / lint (darwin)

func `defaultConfig` is unused (unused)
return Config{
Backend: "auto",
Backend: BackendAuto,
ReplaceFields: false,
PidField: "process.pid",
}
Expand Down

0 comments on commit 0691b06

Please sign in to comment.