Class: LogStash::Filters::Imgsize
- Inherits:
-
Base
- Object
- Base
- LogStash::Filters::Imgsize
- Defined in:
- lib/logstash/filters/imgsize.rb
Overview
This example filter will replace the contents of the default message field with whatever you specify in the configuration.
It is only intended to be used as an example.
Instance Method Summary collapse
Instance Method Details
#filter(event) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/logstash/filters/imgsize.rb', line 35 def filter(event) @logger.debug? && @logger.debug("Running imgsize filter") begin image_url = event[@image_url_field] width, height = FastImage.size(image_url) event.cancel if @drop_on_fail && (width.nil? || height.nil?) event[@image_width_field] = width event[@image_height_field] = height rescue => exception @logger.warn("Imgszie exception occurred. Error: #{exception} ; ImageUrl: #{image_url}") event.cancel if @drop_on_fail end filter_matched(event) end |
#register ⇒ Object
30 31 32 |
# File 'lib/logstash/filters/imgsize.rb', line 30 def register # Add instance variables end |