Class: LogStash::Filters::Ezproxy
- Inherits:
-
Base
- Object
- Base
- LogStash::Filters::Ezproxy
- Defined in:
- lib/logstash/filters/ezproxy.rb
Overview
This 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 .
Instance Method Summary collapse
Instance Method Details
#filter(event) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/logstash/filters/ezproxy.rb', line 47 def filter(event) url = event.get(@url) data = {} uri = URI(URI::extract(url)[0]) # if (uri.host == "ezproxy.lancs.ac.uk") # if (uri.query) # puts uri # params = CGI::parse(uri.query) # if params.key?('url') # uri = URI(params['url'][0]) # elsif params.key?('qurl') # uri = URI(params['qurl'][0]) # end # event.tag("requested_host_ezproxy") # event.set("requested_host", uri.host) # end # end case when uri.host.include?("www.jstor.org") data = Jstor::parse(uri.to_s) when uri.host.include?("www.lexisnexis.com") data = LexisNexis::parse(uri.to_s) when uri.host.include?("journals.sagepub.com") data = Sage::parse(uri.to_s) when uri.host.include?("onlinelibrary.wiley.com") data = Wiley::parse(uri.to_s) when uri.host.include?("www.sciencedirect.com") data = ScienceDirect::parse(uri.to_s) when uri.host.include?("www.dawsonera.com") data = DawsonEra::parse(uri.to_s) when uri.host.include?("www.tandfonline.com") data = TandF::parse(uri.to_s) when uri.host.include?("www.emeraldinsight.com") data = Emerald::parse(uri.to_s) when uri.host.include?("ebscohost.com") data = Ebscohost::parse(uri.to_s) end event.set("request_metadata", data) event.tag("ezproxy_parse_success") # filter_matched should go in the last line of our successful code filter_matched(event) end |
#register ⇒ Object
42 43 44 |
# File 'lib/logstash/filters/ezproxy.rb', line 42 def register # Add instance variables end |