Class: LogStash::Filters::JWTFilter
- Inherits:
-
Base
- Object
- Base
- LogStash::Filters::JWTFilter
- Defined in:
- lib/logstash/filters/jwt.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
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/logstash/filters/jwt.rb', line 39 def filter(event) if event.include?(@field) token = event[@field] begin decoded_token = JWT.decode token, @secret, true, { :algorithm => algorithm } @logger.debug? && @logger.debug("Decoded token is: #{decoded_token}") event['[@metadata][jwt_data]'] = decoded_token.first event.remove(@field) if @remove_token filter_matched(event) rescue => e @logger.error("Invalid JWT token. exception => #{e.inspect}") if @logger end end end |
#register ⇒ Object
34 35 36 |
# File 'lib/logstash/filters/jwt.rb', line 34 def register # Add instance variables end |