class Fluent::Plugin::HaproxyParser
Constants
- REGEXP
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/parser_haproxy.rb, line 13 def configure(conf) super end
parse(text) { |nil, nil| ... }
click to toggle source
# File lib/fluent/plugin/parser_haproxy.rb, line 17 def parse(text) m = REGEXP.match(text) unless m yield nil, nil return end r = {} m.names.each do |name| if value = m[name] r[name] = value end end # request if r["request"] request = r["request"].split(" ") r.delete("request") uri = request[1].split("?") r["method"] = request[0] r["path"] = uri[0] r["query_string"] ||= uri[1] r["http_version"] = request[2] end # headers if r["req_headers"] parsed_headers = r["req_headers"].split("|") r.delete("req_headers") parsed_headers.each_with_index do |header, index| if @headers.empty? r["header_#{index}"] = header else r[@headers[index]] = header end end if r["auth"] type = r["auth"].split(" ")[0] cred = r["auth"].split(" ")[1] r.delete("auth") r["auth_type"] = type if type == "Basic" r["user"] = Base64.decode64(cred).split(":")[0] end end end time, record = convert_values(parse_time(r), r) yield time, record end