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
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/logstash/filters/imgsize.rb', line 34 def filter(event) @logger.debug? && @logger.debug("Running imgsize filter", :event => event) begin image_url = event[@image_url_field] width, height = FastImage.size(image_url) rescue => exception @logger.error("Imgszie exception occurred. Error: #{exception} ; ImageUrl: #{image_url}") width = height = nil end event[@image_width_field] = width event[@image_height_field] = height filter_matched(event) end |
#register ⇒ Object
29 30 31 |
# File 'lib/logstash/filters/imgsize.rb', line 29 def register # Add instance variables end |