Class: RequestLogAnalyzer::FileFormat::Haproxy

Inherits:
Base
  • Object
show all
Extended by:
CommonRegularExpressions
Defined in:
lib/request_log_analyzer/file_format/haproxy.rb

Defined Under Namespace

Classes: Request

Constant Summary

Constants included from CommonRegularExpressions

CommonRegularExpressions::TIMESTAMP_PARTS

Constants inherited from Base

Base::Request

Instance Attribute Summary

Attributes inherited from Base

#line_definitions, #report_trackers

Class Method Summary collapse

Methods included from CommonRegularExpressions

anchored, hostname, hostname_or_ip_address, ip_address, timestamp

Methods inherited from Base

#captures?, create, format_definition, #initialize, line_definer, line_definition, #line_divider, #max_line_length, #parse_line, report, report_definer, #request, #request_class, #setup_environment, #valid_line_definitions?, #valid_request_class?, #well_formed?

Constructor Details

This class inherits a constructor from RequestLogAnalyzer::FileFormat::Base

Class Method Details

.compose_regexp(millisecs, backends, counters, connections, queues) ⇒ Object

substitute version specific parts of the haproxy entry regexp.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/request_log_analyzer/file_format/haproxy.rb', line 8

def self.compose_regexp(millisecs, backends, counters, connections, queues)
  %r{
    (#{ip_address}):\d+\s # client_ip ':' client_port
    \[(#{timestamp('%d/%b/%Y:%H:%M:%S')})#{millisecs}\]\s # '[' accept_date ']'
    (\S+)\s # frontend_name
    #{backends}
    #{counters}
    (\d+)\s # status_code
    \+?(\d+)\s # bytes_read
    (\S+)\s # captured_request_cookie
    (\S+)\s # captured_response_cookie
    (\w|-)(\w|-)(\w|-)(\w|-)\s # termination_state
    #{connections}
    #{queues}
    (\S*)\s? # captured_request_headers
    (\S*)\s? # captured_response_headers
    "([^"]*)" # '"' http_request '"'
  }x
end