Skip to content

Commit

Permalink
Bring back prospector.type which went missing (#4361)
Browse files Browse the repository at this point in the history
It seems in one of the recent refactorings prospector.type went missing. Test added to make sure it will not go missing again.
  • Loading branch information
ruflin authored and andrewkroh committed May 22, 2017
1 parent 8fb1cf9 commit b1e44a5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions filebeat/harvester/forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (f *Forwarder) Send(data *util.Data) error {

if data.HasEvent() {
data.Event[common.EventMetadataKey] = f.Config.EventMetadata
data.Event.Put("prospector.type", f.Config.Type)

// run the filters before sending to spooler
data.Event = f.Processors.Run(data.Event)
Expand Down
28 changes: 28 additions & 0 deletions filebeat/tests/system/test_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from filebeat import BaseTest
import os

"""
Test for basic object
"""


class Test(BaseTest):

def test_base(self):
"""
Test if the basic fields exist.
"""
self.render_config_template(
path=os.path.abspath(self.working_dir) + "/test.log",
)

with open(self.working_dir + "/test.log", "w") as f:
f.write("test message\n")

filebeat = self.start_beat()
self.wait_until(lambda: self.output_has(lines=1))
filebeat.check_kill_and_wait()

output = self.read_output()[0]
assert "@timestamp" in output
assert "prospector.type" in output

0 comments on commit b1e44a5

Please sign in to comment.