Skip to content

Commit

Permalink
More adjustments.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakerouse committed Apr 11, 2024
1 parent 10f58fc commit 88c8fcc
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 36 deletions.
4 changes: 2 additions & 2 deletions filebeat/autodiscover/defaults_aix.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package autodiscover

// Initialize initializes the configuration defaults for autodiscover for filebeat.
func Initialize() {
// InitializeModule initializes this module.
func InitializeModule() {
// does nothing on aix
}
19 changes: 17 additions & 2 deletions filebeat/tests/system/test_autodiscover.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,23 @@ def test_docker(self):
autodiscover={
'docker': {
'cleanup_timeout': '0s',
'templates': f''' - condition:
equals.docker.container.name: {container.name} config: - type: log paths: - %s/${{data.docker.container.name}}.log ''' % self.working_dir, }, },) proc = self.start_beat() self._test(container) self.wait_until(lambda: self.log_contains('Stopping runner: input')) proc.check_kill_and_wait()
'templates': f'''
- condition:
equals.docker.container.name: {container.name}
config:
- type: log
paths:
- %s/${{data.docker.container.name}}.log
''' % self.working_dir,
},
},
)

proc = self.start_beat()
self._test(container)

self.wait_until(lambda: self.log_contains('Stopping runner: input'))
proc.check_kill_and_wait()

@unittest.skipIf(not INTEGRATION_TESTS or
os.getenv("TESTING_ENVIRONMENT") == "2x",
Expand Down
2 changes: 0 additions & 2 deletions heartbeat/include/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions heartbeat/monitors/active/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ import (
"github.com/elastic/elastic-agent-libs/useragent"
)

// InitializeModule initializes this module.
func InitializeModule() {
func init() {
plugin.Register("http", create, "synthetics/http")
}

Expand Down
4 changes: 0 additions & 4 deletions heartbeat/monitors/active/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ import (
btesting "github.com/elastic/beats/v7/libbeat/testing"
)

func TestMain(m *testing.M) {
InitializeModule()
}

func sendSimpleTLSRequest(t *testing.T, testURL string, useUrls bool) *beat.Event {
return sendTLSRequest(t, testURL, useUrls, nil)
}
Expand Down
3 changes: 1 addition & 2 deletions heartbeat/monitors/active/icmp/icmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ import (

var debugf = logp.MakeDebug("icmp")

// InitializeModule initializes this module.
func InitializeModule() {
func init() {
plugin.Register("icmp", create, "synthetics/icmp")
}

Expand Down
4 changes: 0 additions & 4 deletions heartbeat/monitors/active/icmp/icmp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ import (
"github.com/elastic/beats/v7/libbeat/beat"
)

func TestMain(m *testing.M) {
InitializeModule()
}

func TestICMPFields(t *testing.T) {
host := "localhost"
hostURL := &url.URL{Scheme: "icmp", Host: host}
Expand Down
3 changes: 1 addition & 2 deletions heartbeat/monitors/active/tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ import (
"github.com/elastic/elastic-agent-libs/transport/tlscommon"
)

// InitializeModule initializes this module.
func InitializeModule() {
func init() {
plugin.Register("tcp", create, "synthetics/tcp")
}

Expand Down
4 changes: 0 additions & 4 deletions heartbeat/monitors/active/tcp/tcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ import (
btesting "github.com/elastic/beats/v7/libbeat/testing"
)

func TestMain(m *testing.M) {
InitializeModule()
}

func testTCPCheck(t *testing.T, host string, port uint16) *beat.Event {
config := mapstr.M{
"hosts": host,
Expand Down
1 change: 1 addition & 0 deletions libbeat/asset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func init() {
func Asset{{ .GoTypeName }}() string {
return "{{ .Data }}"
}
`))

type Data struct {
Expand Down
3 changes: 2 additions & 1 deletion metricbeat/include/list_init.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packetbeat/tests/system/test_0065_unmatched_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def check_event(event, expected):
for key in expected:
assert key in event, "key '{0}' not found in event".format(key)
assert event[key] == expected[key], \
assert event[key] == expected[key],\
"key '{0}' has value '{1}', expected '{2}'".format(key,
event[key],
expected[key])
Expand Down
14 changes: 5 additions & 9 deletions x-pack/auditbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,10 @@ import (
"github.com/elastic/beats/v7/x-pack/auditbeat/include"
"github.com/elastic/beats/v7/x-pack/libbeat/management"

// Register includes.
// Register base auditbeat includes.
_ "github.com/elastic/beats/v7/auditbeat/include"

// Register modules.
_ "github.com/elastic/beats/v7/auditbeat/module/auditd"
_ "github.com/elastic/beats/v7/auditbeat/module/file_integrity"

// Register Auditbeat x-pack modules.
_ "github.com/elastic/beats/v7/x-pack/auditbeat/include"
// Register libbeat x-pack modules.
_ "github.com/elastic/beats/v7/x-pack/libbeat/include"
)

Expand All @@ -47,9 +42,10 @@ func auditbeatCfg(rawIn *proto.UnitExpectedConfig, agentInfo *client.AgentInfo)
return nil, fmt.Errorf("error creating input list from raw expected config: %w", err)
}

// not running in agentbeat; extract the type field that has
// "audit/auditd", treat this as the module config key
// Extract the type field that has "audit/auditd", treat this
// as the module config key
module := strings.Split(rawIn.Type, "/")[1]

for iter := range modules {
modules[iter]["module"] = module
}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/osquerybeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/spf13/cobra"

"github.com/elastic/beats/v7/x-pack/libbeat/management"
"github.com/elastic/elastic-agent-client/v7/pkg/client"
"github.com/elastic/elastic-agent-client/v7/pkg/proto"
"github.com/elastic/elastic-agent-libs/logp"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/elastic/beats/v7/libbeat/processors"
"github.com/elastic/beats/v7/libbeat/publisher/processing"
_ "github.com/elastic/beats/v7/x-pack/libbeat/include"
"github.com/elastic/beats/v7/x-pack/libbeat/management"
"github.com/elastic/beats/v7/x-pack/osquerybeat/beater"
_ "github.com/elastic/beats/v7/x-pack/osquerybeat/include"
"github.com/elastic/beats/v7/x-pack/osquerybeat/internal/config"
Expand Down

0 comments on commit 88c8fcc

Please sign in to comment.