Class: LogStash::Inputs::CloudStorage::BlobFilter
- Inherits:
-
Object
- Object
- LogStash::Inputs::CloudStorage::BlobFilter
- Defined in:
- lib/logstash/inputs/cloud_storage/blob_filter.rb
Overview
BlobFilter acts as a .filter for BlobAdapters.
Instance Method Summary collapse
-
#initialize(logger, include_regex, exclude_regex, metadata_key, processed_db) ⇒ BlobFilter
constructor
Initialize the filter.
-
#should_process?(blob) ⇒ Boolean
should_process? returns true if the blob matches all the user-provided requirements to download and extract events.
Constructor Details
#initialize(logger, include_regex, exclude_regex, metadata_key, processed_db) ⇒ BlobFilter
Initialize the filter. Throws an exception if the regular expressions could not compile.
10 11 12 13 14 15 16 17 18 |
# File 'lib/logstash/inputs/cloud_storage/blob_filter.rb', line 10 def initialize(logger, include_regex, exclude_regex, , processed_db) @logger = logger @include_regex = compile_regex(include_regex) @exclude_regex = compile_regex(exclude_regex) @metadata_key = @processed_db = processed_db @logger.info('Turn on debugging to explain why blobs are filtered.') end |
Instance Method Details
#should_process?(blob) ⇒ Boolean
should_process? returns true if the blob matches all the user-provided requirements to download and extract events.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/logstash/inputs/cloud_storage/blob_filter.rb', line 22 def should_process?(blob) @logger.debug("Found blob: #{blob.name}") # Evaluate all conditions because the operations are cheap and give the # user a complete idea of why a blob was included/excluded. conditions = [ not_already_run?(blob), included?(blob), not_excluded?(blob), (blob) ] conditions.all? end |