Class: Logasm::Preprocessors::Whitelist
- Inherits:
-
Object
- Object
- Logasm::Preprocessors::Whitelist
- Defined in:
- lib/logasm/preprocessors/whitelist.rb
Defined Under Namespace
Classes: InvalidPointerFormatException
Constant Summary collapse
- DEFAULT_WHITELIST =
%w(/id /message /correlation_id /queue)- MASK_SYMBOL =
'*'- MASKED_VALUE =
MASK_SYMBOL * 5
- WILDCARD =
'~'
Instance Method Summary collapse
-
#initialize(config = {}) ⇒ Whitelist
constructor
A new instance of Whitelist.
- #process(data) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Whitelist
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/logasm/preprocessors/whitelist.rb', line 13 def initialize(config = {}) pointers = (config[:pointers] || []) + DEFAULT_WHITELIST decoded_pointers = pointers .each(&method(:validate_pointer)) .map(&method(:decode)) @fields_to_include = decoded_pointers.inject({}) do |mem, pointer| mem.merge(pointer => true) end @wildcards = decoded_pointers .select(&method(:has_wildcard?)) .inject({}) do |mem, pointer| mem.merge(get_wildcard_roots_of(pointer)) end end |
Instance Method Details
#process(data) ⇒ Object
28 29 30 |
# File 'lib/logasm/preprocessors/whitelist.rb', line 28 def process(data) process_data('', data) end |