Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- awss3 input: Fix handling of SQS notifications that don't contain a region. {pull}40628[40628]
- Fix credential handling when workload identity is being used in GCS input. {issue}39977[39977] {pull}40663[40663]
- Fix publication of group data from the Okta entity analytics provider. {pull}40681[40681]
- Ensure netflow custom field configuration is applied. {issue}40735[40735] {pull}40730[40730]

*Heartbeat*

Expand Down
1 change: 1 addition & 0 deletions x-pack/filebeat/input/netflow/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (im *netflowInputManager) Create(cfg *conf.C) (v2.Input, error) {

input := &netflowInput{
cfg: inputCfg,
customFields: customFields,
internalNetworks: inputCfg.InternalNetworks,
logger: im.log,
queueSize: inputCfg.PacketQueueSize,
Expand Down
22 changes: 22 additions & 0 deletions x-pack/filebeat/input/netflow/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"

"github.com/elastic/beats/v7/libbeat/tests/resources"
"github.com/elastic/beats/v7/x-pack/filebeat/input/netflow/decoder/fields"

conf "github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/logp"
Expand All @@ -29,3 +30,24 @@ func TestNewInputDone(t *testing.T) {
_, err = Plugin(logp.NewLogger("netflow_test")).Manager.Create(config)
require.NoError(t, err)
}

func TestConfig_CustomDefinitions(t *testing.T) {
goroutines := resources.NewGoroutinesChecker()
defer goroutines.Check(t)

wantDefinitions, err := LoadFieldDefinitionsFromFile("testdata/fields/netflow9_cisco_asa_custom.yaml")
require.NoError(t, err)
want := []fields.FieldDict{wantDefinitions}

config, err := conf.NewConfigFrom(mapstr.M{
"custom_definitions": []string{"testdata/fields/netflow9_cisco_asa_custom.yaml"},
})
require.NoError(t, err)

v2input, err := Plugin(logp.NewLogger("netflow_test")).Manager.Create(config)
require.NoError(t, err)

input := v2input.(*netflowInput)

require.EqualValues(t, input.customFields, want)
}