mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
parent
840439722d
commit
550a6ea554
2 changed files with 10 additions and 1 deletions
|
@ -78,7 +78,8 @@ module LogStash; module Config; module AST
|
|||
definitions << "define_singleton_method :#{type}_func do |event|"
|
||||
definitions << " targeted_outputs = []" if type == "output"
|
||||
definitions << " events = event" if type == "filter"
|
||||
definitions << " @logger.debug? && @logger.debug(\"#{type} received\", \"event\" => event.to_hash)"
|
||||
definitions << " @logger.debug? && @logger.debug(\"#{type} received\", \"event\" => event.to_hash)" if type == "output"
|
||||
definitions << " @logger.debug? && events.each { |e| @logger.debug(\"#{type} received\", \"event\" => e.to_hash)}" if type == "filter"
|
||||
|
||||
sections.select { |s| s.plugin_type.text_value == type }.each do |s|
|
||||
definitions << s.compile.split("\n", -1).map { |e| " #{e}" }
|
||||
|
|
|
@ -254,6 +254,14 @@ describe LogStash::Pipeline do
|
|||
pipeline = mock_pipeline_from_string(test_config_with_filters, pipeline_settings_obj)
|
||||
pipeline.close
|
||||
end
|
||||
|
||||
it "should log each filtered event if config.debug is set to true" do
|
||||
pipeline_settings_obj.set("config.debug", true)
|
||||
pipeline = mock_pipeline_from_string(test_config_with_filters, pipeline_settings_obj)
|
||||
expect(logger).to receive(:debug).with(/filter received/, anything)
|
||||
pipeline.filter_func([LogStash::Event.new])
|
||||
pipeline.close
|
||||
end
|
||||
end
|
||||
|
||||
context "when there is no command line -w N set" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue