Module: LogStasher::CustomFields::LogSubscriber
- Defined in:
- lib/logstasher/custom_fields.rb
Instance Method Summary collapse
Instance Method Details
#extract_custom_fields(data) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/logstasher/custom_fields.rb', line 6 def extract_custom_fields(data) # Don't mutate the original payload; slice the requested fields instead fields = CustomFields.custom_fields return {} if fields.empty? data.respond_to?(:slice) ? data.slice(*fields) : fields.each_with_object({}) { |k, h| h[k] = data[k] if data.key?(k) } end |