Skip to content

Commit

Permalink
Fix event_logs.processors config being rejected (#6217)
Browse files Browse the repository at this point in the history
The `event_logs.processors` keyword was being rejected as invalid config by Winlogbeat. This fixes the issue by adding "processors" as an allowed configuration key for `event_logs` and adds a system test case.
  • Loading branch information
andrewkroh authored and ruflin committed Jan 31, 2018
1 parent a02fc6d commit 5c26e96
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di

- Fix the registry file. It was not correctly storing event log names, and
upon restart it would begin reading at the start of each event log. {issue}5813[5813]
- Fix config validation to allow `event_logs.processors`. [pull]6217[6217]

==== Added

Expand Down
3 changes: 2 additions & 1 deletion winlogbeat/eventlog/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
"github.com/elastic/beats/libbeat/common"
)

var commonConfigKeys = []string{"api", "name", "fields", "fields_under_root", "tags"}
var commonConfigKeys = []string{"api", "name", "fields", "fields_under_root",
"tags", "processors"}

// ConfigCommon is the common configuration data used to instantiate a new
// EventLog. Each implementation is free to support additional configuration
Expand Down
5 changes: 5 additions & 0 deletions winlogbeat/tests/system/config/winlogbeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ winlogbeat.event_logs:
{%- if log.invalid is defined %}
invalid: {{ log.invalid }}
{% endif %}
{% if log.extras -%}
{% for k, v in log.extras.items() -%}
{{ k }}: {{ v }}
{% endfor %}
{% endif -%}
{% endfor -%}
{% endif %}

Expand Down
27 changes: 27 additions & 0 deletions winlogbeat/tests/system/test_eventlogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,30 @@ def test_registry_data(self):
self.assertIn(self.providerName, event_logs)
record_number = event_logs[self.providerName]["record_number"]
self.assertGreater(record_number, 0)

def test_processors(self):
"""
eventlogging - Processors are applied
"""
self.write_event_log("Hello world!")

config = {
"event_logs": [
{
"name": self.providerName,
"api": self.api,
"extras": {
"processors": [
{
"drop_fields": {
"fields": ["message"],
}
}
],
},
}
]
}
evts = self.read_events(config)
self.assertTrue(len(evts), 1)
self.assertNotIn("message", evts[0])
27 changes: 27 additions & 0 deletions winlogbeat/tests/system/test_wineventlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,30 @@ def test_registry_data(self):
self.assertIn(self.providerName, event_logs)
record_number = event_logs[self.providerName]["record_number"]
self.assertGreater(record_number, 0)

def test_processors(self):
"""
wineventlog - Processors are applied
"""
self.write_event_log("Hello world!")

config = {
"event_logs": [
{
"name": self.providerName,
"api": self.api,
"extras": {
"processors": [
{
"drop_fields": {
"fields": ["message"],
}
}
],
},
}
]
}
evts = self.read_events(config)
self.assertTrue(len(evts), 1)
self.assertNotIn("message", evts[0])

0 comments on commit 5c26e96

Please sign in to comment.